Consider a classStudent. The following code is used to create objects and access its member functions. Which statement is true about the code? int main() { Student newStud; Student stud; Student oldStud; stud.GetDetails(); return 0; } a. There are three objects created of Student class and they each have their own memory allocations. The GetDetails() function is invoked for all objects of the class Student. b. There are three objects created of Student class and they each have their own memory locations. The GetDetails() function is invoked for only the stud object of the class Student. c. There are three objects created of Student class and the compiler allocates only one memory location. The GetDetails() function is invoked for only the stud object of the class Student. d. There are three objects created of Student class and the compiler allocates only

Respuesta :

Answer:

b. There are three objects created of Student class and they each have their own memory locations. The GetDetails() function is invoked for only the stud object of the class Student.

Explanation:

When you look at the code, you will see three object of the Student class is created: newStud, stud, and, oldStud, having their own memory locations. Meaning, the value of the data member in Student class can be different for newStud and stud. Even though all the objects can access the GetDetails() function, only the stud object called the GetDetails() function, stud.GetDetails();