1 int main(){ 2 3 MyTree *t1 = new MyTree(1); 4 MyTree *t2 ; 5 t2->val = 2; 6 cout<<t1->val<<" "<<t2->val; //输出:1 2 7 t2.val = 3; //error: request for member 'val' in 't2', whitch is of pointer type 'MyTree*' (maybe you meant to use '->' ?) 8 cout<<t2.val; //error: request for member 'val' in 't2', which is of pointer type 'MyTree*' (maybe you mean to use '->' ? 9 return 0; 10 }
版权声明:
本文来源网络,所有图片文章版权属于原作者,如有侵权,联系删除。
本文网址:https://www.mushiming.com/mjsbk/9764.html