Skip to content

Instantly share code, notes, and snippets.

@abhi1010
Created May 7, 2014 14:39
Show Gist options
  • Save abhi1010/8fac0155f30551df8bca to your computer and use it in GitHub Desktop.
Save abhi1010/8fac0155f30551df8bca to your computer and use it in GitHub Desktop.
Multiple Inheritance in C++
#include <iostream>
using std::endl;
using std::cout;
class Foo
{
public: Foo() { std::cout << std::endl << "Foo ";}
};
class Bar: virtual Foo
{
public: Bar() { cout << "Bar "; }
};
class FooToo : virtual Foo
{
public: FooToo() { std::cout << "FooToo ";}
};
class FooTooBar : virtual FooToo, Bar
{
public: FooTooBar() { cout << "FootTooBar ";}
};
int main()
{
FooTooBar bar;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment