Complete the given code to get the output shown below:-
Base1
Base2
#include<iostream>
using namespace std;
class Base1 {
public:
void display()
{ cout << " Base1"<< endl; } };
class Base2 {
public:
void display()
{ cout << "Base2"<<endl"; } };
class Derived: public Base1, public Base2 {
public:
};
int main()
{
Derived d;
return 0;
}
#include<iostream>
using namespace std;
class Base1 {
public:
void display(){
cout << "Base1"<< endl;
}
};
class Base2 {
public:
void display(){
cout << "Base2"<<endl;
}
};
class Derived: public Base1, public Base2 {
public:
Derived(){
Base1::display();
Base2::display();
}
};
int main(){
Derived d;
return 0;
}
Comments
Leave a comment