最赞回答 / qq_潋愍憧憬_0
在类中定义的成员函数全部默认为内联函数。可以显示加上 inline 标识符,或者不加。在类中声明的成员函数,如果没加inline,则在类外定义该成员函数时加了inline,该成员函数也为内联函数。
2016-09-18
正确打开方式;-)
Coordinate coor;
coor.x = 10;
coor.y = 10;
coor.printX();
coor.printY();
Coordinate *p = new Coordinate();
//申请失败
if(NULL == p){
return 0;
}
p->x = 20;
p->y = 30;
p->printX();
p->printY();
(*p).x = 30;
(*p).y = 40;
(*p).printX();
(*p).printY();
//释放内存
delete p;
p = NULL;
Coordinate coor;
coor.x = 10;
coor.y = 10;
coor.printX();
coor.printY();
Coordinate *p = new Coordinate();
//申请失败
if(NULL == p){
return 0;
}
p->x = 20;
p->y = 30;
p->printX();
p->printY();
(*p).x = 30;
(*p).y = 40;
(*p).printX();
(*p).printY();
//释放内存
delete p;
p = NULL;
2016-09-17