Remove duplicate code.

This commit is contained in:
Arnie97 2015-04-17 22:51:02 +08:00
parent c5212932b9
commit 7bab2c5e8d

View File

@ -289,8 +289,6 @@ public:
}; // 在类的定义之后,要加一个分号
}; // 记住,在类的定义之后,要加一个分号!
// 类的成员函数通常在.cpp文件中实现。
void Dog::Dog()
{
@ -309,22 +307,6 @@ void Dog::setWeight(int dogsWeight)
weight = dogsWeight;
}
// 虚函数的virtual关键字只需要在声明时使用不需要在定义时出现
void Dog::print() const
{
std::cout << "Dog is " << name << " and weighs " << weight << "kg\n";
}
void Dog::~Dog()
{
cout << "Goodbye " << name << "\n";
}
void Dog::setWeight(int dogsWeight)
{
weight = dogsWeight;
}
// 虚函数的virtual关键字只需要在声明时使用不需要在定义时重复
void Dog::print() const
{