#include<iostream>
using namespace std;
class People{
public:
void getStature(){
cout
<<"Zing的升高爲:"<<stature<<"cm"<<endl;
}
void getWeight();
void setStature(int x){
stature = x;
}
void setWeight(int y);
private:
int stature = 0;
int weight = 0;
};
void People::getWeight(){
cout << "Zing的體重爲:" << weight
<< "kg" << endl;
}
void People::setWeight(int y){
weight = y;
}
void main(){
People Zing;
Zing.setStature(179);
Zing.setWeight(60);
Zing.getStature();
Zing.getWeight();
system("pause");
}
更多詳情請點擊 http://blog.sina.com.cn/zhaojianjunzjj