// Listing 12.6 Hiding methods

#include <iostream>
using namespace std;

class Mammal
{
public:
	void Move() const { cout << "Mammal move one step.\n"; }
	void Move(int distance) const
	{
		cout << "Mammal move ";
		cout << distance <<" steps.\n";
	}

protected:
	int itsAge;
	int itsWeight;
};

class Dog : public Mammal
{
public:
	// Some compilers display warnings when you hide a method.
	void Move() const { cout << "Dog move 5 steps.\n"; }
};

int main()
{
	Mammal bigAnimal;
	Dog fido;
	bigAnimal.Move();	// Mammal move one step.
	bigAnimal.Move(2);	// Mammal move 2 steps.
	fido.Move();		// Dog move 5 steps.
	// fido.Move(10);	// compile error since the Move(int) method is "hidden"
						// to the Dog class. The Dog class could have called the Move(int) method 
						// if it had not overriden the no-parameter version of Move()
						// this is similar to the rule that a derived class can't use a base 
						// class's default constructor if a derived class override a "other" constructor
	return 0;
}
