📄 animal.cpp
字号:
// Chapter 10 of C++ How to Program
// Debugging Problem (animal.cpp)
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
using std::string;
#include "animal.h"
// default constructor
Animal::Animal( int h, int w )
{
height = h;
weight = w;
} // end class Animal constructor
// function print definition
void Animal::print() const
{
//cout << "This animal's height and weight are as follows:\n"
// << "Height: " << height << "\tWeight: " << weight
//<< endl << endl;
} // end function print
// return height
int Animal::getHeight() const
{
return height;
} // end function getHeight
// return weight
int Animal::getWeight() const
{
return weight;
} // end function getWeight
// function setHeight definition
void Animal::setHeight( int h )
{
height = h;
} // end function setHeight
// function setWeight definition
void Animal::setWeight( int w )
{
weight = w;
} // end function setWeight
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -