Computer Science - Object Oriented Programming Using C++ - Discussion
Discussion Forum : Object Oriented Programming Using C++ - Section 8 (Q.No. 17)
17.
Assume a class Derv that is privately derived from class Base. An object of class Derv located in main() can access
Discussion:
4 comments Page 1 of 1.
Omar Othman said:
1 decade ago
The correct answer is D.
Namrata said:
7 years ago
The Correct answer is D.
Abhijit Deshmukhya said:
7 years ago
Public members of base class will become private in derived class if it is privately inherited. So it will be not accessible by an object of derived class which is located in main () rather it will be accessible by only the member functions of the base class.
Sabari said:
4 years ago
The Correct answer is D.
In private inheritance, the access status of parent class members in the derived class is restricted. The private, protected and public members of parent class all become the private members of derived class.
In private inheritance, the private, protected and public members of derived class can access the protected and public members of parent class.
However, the object of the derived class can only access public members of derived class directly.
The object of the parent class cannot access any member of parent class directly.
In private inheritance, all public and protected members of base class become private members in child class objects.
In private inheritance, the access status of parent class members in the derived class is restricted. The private, protected and public members of parent class all become the private members of derived class.
In private inheritance, the private, protected and public members of derived class can access the protected and public members of parent class.
However, the object of the derived class can only access public members of derived class directly.
The object of the parent class cannot access any member of parent class directly.
In private inheritance, all public and protected members of base class become private members in child class objects.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers