Skip to content

Instantly share code, notes, and snippets.

@therocode
Created January 19, 2016 20:24
Show Gist options
  • Save therocode/fc1a820bedeff2554368 to your computer and use it in GitHub Desktop.
Save therocode/fc1a820bedeff2554368 to your computer and use it in GitHub Desktop.
class Animal
{
public:
virtual void makeNoise() const
{
std::cout << "...\n";
}
virtual ~Animal() {}
};
class Monkey : public Animal
{
public:
void makeNoise() const override
{
std::cout << "oh oh AH!\n";
}
};
class Giraffe : public Animal
{
public:
void makeNoise() const override
{
std::cout << "moooo\n";
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment