C++ | Inheritance | Question 7
(A) Compiler Error in line ” bp->show()”
(B) Compiler Error in line ” cout <x”
(C) In Base 10
(D) In Derived 10
Explanation: A base class pointer can point to a derived class object, but we can only access base class member or virtual functions using the base class pointer because object slicing happens when a derived class object is assigned to a base class object. Additional attributes of a derived class object are sliced off to form the base class object.
Quiz of this Question