32 this->brain =
new Brain();
45 this->brain =
new Brain(*(other.brain));
63void Dog::swap(
Dog &other) {
std::swap(this->brain, other.brain); }
The Animal class represents a generic animal.
Represents the brain of an animal, holding a collection of ideas.
The Dog class represents a canine animal.
Dog()
Default constructor for Dog. Calls the Animal base class constructor and sets the type to "Dog"....
Dog & operator=(const Dog &other)
Copy assignment operator for Dog. (Copy And Swap Idiom) Displays a specific copy assignment message.
virtual void makeSound() const
Makes the characteristic sound of a dog ("Woof!"). This function overrides the virtual makeSound() fr...
Brain * getBrain() const
Gets a pointer to the Dog's Brain object.
virtual ~Dog()
Destructor for Dog. Displays a specific destruction message.
void bark() const
Makes a specific barking sound for a Dog. This is a Dog-specific method.