Need a project done?

C++ Programming Developer

Search This Blog

Inheritance example C++


#include <iostream>
using namespace std;

class cc{

};

class m:  public cc{
public:
void f(){
cout << "m" << endl << endl;
}
};
class l:  public cc{
public:
void f(){
cout << "l" << endl << endl;
}
};
class v:  public cc{
public:
void f(){
cout << "v" << endl << endl;
}
};

class ll: public m, public l, public v{
};

int main(){
ll *p = new ll;

p->m::f();
return 0;
}

No comments:

Post a Comment

"Don't let anyone ever make you feel like you don't deserve what you want."