Friday, 23 April 2021

Inheritance in C++ Qus: 5

 #include<iostream.h>

#include<conio.h>

class A

{

public:

A(int a)

{

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

}

};

class B

{

public:

B(int a)

{

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

}

};

class C: A,B

{

public:

C():B(7),A(5)

{

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

}

};

int main()

{

clrscr();

C ob;

getch();

return 0;


}

No comments:

Post a Comment