// Base class
class Animal {
public:
void animalSound() {
cout << "The animal makes a sound
" ;
}
};
// Derived class
class Pig : public Animal {
public:
void animalSound() {
cout << "The pig says: wee wee
" ;
}
};
// Derived class
class Dog : public Animal {
public:
void animalSound() {
cout << "The dog says: bow wow
" ;
}
};