这样的错误 local class member functions must be defined within the class
okop 2003-09-14 09:55:41
这样的错误 local class member functions must be defined within the class这样的程序
#include<iostream.h>
void main(void)
{
class man
{
public:
void setx(int x);
void sety(int y);
int result(void);
private:
int r;
int h;
};
void man::setx(int x)
{
r=x;
}
void man::sety(int y)
{
h=y;
}
int man::result(void)
{
return r*h;
}
man objman;
objman.setx(10);
objman.sety(10);
cout<<objman.result();
}