热门

最新

红包

立Flag

投票

同城

我的

发布
qq_44810930
言之。
4 年前
trueqq_44810930

尚硅谷资料 网盘 https://pan.baidu.com/s/1CJceeI_t32Ct3j6xtvSrvw?_at_=1617799096907#list/path=%2F&parentPath=%2Fsharelink120553861-585518511220395

CSDN App 扫码分享
分享
评论
点赞
打赏
  • 复制链接
  • 举报
下一条:
两段代码仅注释处不一样,为什么第二个代码会出错呢,求问大佬,谢谢!一`#include<iostream>using namespace std;class Sample{ int x, y;public: Sample() { x = y = 0; } Sample(int a, int b) { x = a, y = b; } void disp() { cout << "x=" << x << ",y=" << y << endl; }};void main(){ Sample s(2, 3), *p = &s;//此处 p->disp();}二、#include<iostream>using namespace std;class Sample{ int x, y;public: Sample() { x = y = 0; } Sample(int a, int b) { x = a, y = b; } void disp() { cout << "x=" << x << ",y=" << y << endl; }};void main(){ Sample s(2, 3); *p = &s;//此处有错误 p->disp();}
立即登录