Saturday, 16 May 2015

Q 70,paper 3,J 12. Assume that we have constructor functions for both base class and derived class. Now consider the declaration in main( ). Base * P = New Derived; in what sequence will the constructor be called ?


(A) Derived class constructor followed by Base class constructor.
(B) Base class constructor followed by derived class constructor.
(C) Base class constructor will not be called.
(D) Derived class constructor will not be called.
Answer (B)
1. Whether derived class's default constructor is called or parameterised is called, base class's default constructor is always called inside them.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.