I am not sure of the purpose of "const" keyword in the line:
int GetAge() const { return itsAge; }
If I remove the "const" keyword, the program still works.
class Mammal
{
public:
// constructors
Mammal();
Mammal(int age);
~Mammal();
//accessors
int GetAge() const { return itsAge; }
void SetAge(int age) { itsAge = age; }
int GetWeight() const { return itsWeight; }
void SetWeight(int weight) { itsWeight = weight; }
protected:
int itsAge;
int itsWeight;
}