Skip to content

Instantly share code, notes, and snippets.

@Intrepidd
Created February 1, 2012 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Intrepidd/1718685 to your computer and use it in GitHub Desktop.
Save Intrepidd/1718685 to your computer and use it in GitHub Desktop.
#include <iostream>
class Dad
{
public:
Dad()
{
this->hello();
}
virtual void hello()
{
std::cout << "Hello from dad" << std::endl;
}
void init()
{
this->hello();
}
};
class Kid : public Dad
{
public:
Kid() : Dad()
{
this->init();
}
void hello()
{
std::cout << "Hello from kid" << std::endl;
}
};
int main()
{
Kid a;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment