// Base class
class Animal {
public:
void animalSound() {
cout << "The animal makes a sound
" ;
}
};
// Derived class
class Dog : public Animal {
public:
void animalSound() {
cout << "The dog says: bow wow
" ;
}
};
int main() {
Animal myAnimal;
Dog myDog;
myAnimal.animalSound();
myDog.animalSound();
return 0;
}