如果我们在类中声明一个成员函数但是在类之外定义它,那么在关闭类之后的半冒号呢
答案 0 :(得分:3)
一个人为的例子,显示哪些位需要;
以及哪些位不是:
class Point
{
int x; // Member variable declarations need terminating with ;
int y;
public:
int getX (); // Member function declarations need terminating with ;
int getY ();
}; // Class declaration needs terminating with ; , even if the function definition follows
int Point::getX ()
{
return x;
} // Member function definition doesn't have a terminating ;
希望这能回答你的问题,但如果没有,请澄清问题。