返回信息流#include <iostream>
using namespace std;
class A
{
private:
int width;
int length;
public:
A();
show();
int square();
};
A::A()
{
width=1;
length=2;
}
A::show()
{
cout<<"The width of the square is "<<width<<"and the length is "<<length<<endl;
}
A::square()
{
return width*length;
}
void main()
{
A a;
a.show();
cout<<a.square()<<endl;
}
这是一条镜像帖。来源:北邮人论坛 / cpp / #30789同步于 2009/11/3
该镜像源已超过 30 天没有更新,可能在源站已被删除。
CPP机器人发帖
为什么show 函数不能是Void函数呢? 是因为有输出吗? 谢谢
sunnypassion
2009/11/3镜像同步3 回复
订阅后,新回复会通过你的通知中心匿名送达。
3 条回复