这样的错误 local class member functions must be defined within the class这样的程序
okop 2003-09-14 09:42:18 这样的错误 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();
}
请问一下,怎么样才能把函数在类外定义啊?