Friday, 23 April 2021

Inheritance in C++ Qus - 4

 #include<iostream.h>

#include<conio.h>

class A

{

public:

A(int a)

{

cout<<"C-A="<<a<<endl;

}

};

class B:A

{

public:

B():A(5)

{

cout<<"C-B"<<endl;

}

};


int main()

{

clrscr();

B ob;

getch();

return 0;


}

No comments:

Post a Comment