Suppose class Child is derived from class Parent that was in turn derived from class GrandParent. When we declare an object of class Child, three constructors are called: i) Child, ii) Parent, iii )GrandParent.. What is the order?

a. Child, Parent, GrandParent
b. Parent, GrandParent, Child
c. GrandParent, Child, Parent
d. GrandParent, Parent, Child
e. GrandParent, Child, Parent

c) In an inheritance chain, the base class constructor is called first, then the constructor of the first class in the inheritance chain, and so on.

Computer Science & Information Technology

You might also like to view...

All the Objects contained in an Access database will be displayed in the ________

Fill in the blank(s) with correct word

Computer Science & Information Technology

Which statement is false?

a) Pseudocode is an artificial and informal language that helps you develop algorithms. b) Pseudocode is similar to everyday English. c) Pseudocode is an actual programming language. d) Pseudocode programs are not actually executed on computers.

Computer Science & Information Technology