Consider the following class declaration: class Student { public: int * grades; Student (int n) { // dynamically allocate an -Student () { // delete the array of grades ) } ; Consider also the following statements: Student * s1 new Student (); %3D Student * s2 = new Student (s1); Select one or more: O a. s1 and s2 point at the same Student object b. Deleting s1 also deletes s2. C. Changing s1.grades[0] changes also s2.grades[0]. Od. Int al10]:

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter10: Classes And Data Abstraction
Section: Chapter Questions
Problem 24PE
icon
Related questions
Question

class Student {

public :

int * grades ;

Student ( int n ) { // dynamically allocate an array of grades of size n } 

~Student ( ) { // delete the array of grades }

};

Consider the following class declaration:
class Student {
public:
int * grades;
Student (int n) { // dynamically allocate an
-Student () { // delete the array of grades )
} ;
Consider also the following statements:
Student * sl
new Student ();
%3D
Student * s2 = new Student (s1);
Select one or more:
O a. s1 and s2 point at the same Student object
b. Deleting s1 also deletes s2.
C. Changing s1.grades[0] changes also s2.grades[0].
Od. Int a[10]:
Transcribed Image Text:Consider the following class declaration: class Student { public: int * grades; Student (int n) { // dynamically allocate an -Student () { // delete the array of grades ) } ; Consider also the following statements: Student * sl new Student (); %3D Student * s2 = new Student (s1); Select one or more: O a. s1 and s2 point at the same Student object b. Deleting s1 also deletes s2. C. Changing s1.grades[0] changes also s2.grades[0]. Od. Int a[10]:
Consider the following class declaration:
class Student {
public:
int * grades;
Student (int n) { // dynamically allocate an
-Student () { // delete the array of grades )
} ;
Consider also the following statements:
Student * sl
new Student ();
%3D
Student * s2 = new Student (s1);
Select one or more:
O a. s1 and s2 point at the same Student object
b. Deleting s1 also deletes s2.
C. Changing s1.grades[0] changes also s2.grades[0].
Od. Int a[10]:
Transcribed Image Text:Consider the following class declaration: class Student { public: int * grades; Student (int n) { // dynamically allocate an -Student () { // delete the array of grades ) } ; Consider also the following statements: Student * sl new Student (); %3D Student * s2 = new Student (s1); Select one or more: O a. s1 and s2 point at the same Student object b. Deleting s1 also deletes s2. C. Changing s1.grades[0] changes also s2.grades[0]. Od. Int a[10]:
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning