[cpp]
#include <iostream>
using namespace std;
class mam{
public:
void move() const {cout << "mammal move one step.\n"; }
void move(int distance)const {
cout << "mommal move";
cout <<" " << distance << " " <<"steps." << endl;
}
protected:
int age;
int weight;
};
class dog:public mam {
public:
void move()const { cout << "dog move 5 steps. " << endl; }
};
int main()
{
mam animal;
dog fido;
animal.move();
animal.move(2);
fido.move();
fido.mam::move(10); //調用基類的方法。
return 0;
}