C++ examples for Class:Inheritance
Deriving from Two Different Classes
#include <iostream> using namespace std; class Mom {// ww w.j a va2s. co m public: void Brains() { cout << "I'm smart!" << endl; } }; class Dad { public: void Beauty() { cout << "I'm beautiful!" << endl; } }; class Derived : public Mom, public Dad { }; int main(int argc, char *argv[]) { Derived child; child.Brains(); child.Beauty(); return 0; }