Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#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