Well, one obvious problem is that you declared the overloaded operator<< as:
Code:
friend ostream& operator << (ostream& output, const Animal& theAnimal);
but the name Animal has not been declared at that point. You probably want to declare it as a non-member non-friend function:
Code:
ostream& operator << (ostream& output, const Dog& theAnimal);
Other than that, it looks okay, but:
- You #include <iostream> because you use std::cout to print some text to help you see how the constructors and destructor work. This is fine, but you should #include <ostream> as well because when you do remove the printing of those text, you should then remove <iostream> from the list of files included.
- Do not use using declarations (e.g., using std::cin) in a header file except within some restricted scope.
- Declare the constructor that takes an int as explicit since it probably does not make sense to write: Dog dog = 10;