![]() |
#2
zczhao0505122012-08-07 21:34
回复 楼主 Aidoneus
|
#include <iostream>
using namespace std;
class renlei
{
public:
void huodeshengao(){cout<<shengao;}
void shezhishengao(int x){shengao=x;}
void huodetizhong();
void shezhitizhong(int x);
private:
int shengao;
int tizhong;
};
void renlei::shezhitizhong(int x)
{
tizhong=x;
}
void renlei::huodetizhong()
{
cout<<tizhong;
}
void main()
{
renlei kangqiu;
kangqiu.shezhishengao(8);
kangqiu.huodeshengao();
cout<<endl;
kangqiu.shezhitizhong(80); //为什么无法输出这个80.
kangqiu.huodetizhong;
}