Quiz

Let's check your understanding of the Inheritance.

1

What will be the output of following piece of code?

class Base {
  public:
  Base(){ 
    cout << "Base constructor!" << endl; 
  }
};

class Derived: public Base {
  public:
  Derived(){
    cout << "Derived constructor!" << endl;  
  }
};

int main(){
  Derived d;
}


A)

Derived constructor!

B)

Derived constructor!
Base constructor!

C)

Base constructor!
Derived constructor!

D)

None of the above

Question 1 of 100 attempted

Get hands-on with 1200+ tech skills courses.