我正在学习C++指针,->操作员对我来说似乎很奇怪.而不是 ptr->hello();一个人可以写,(*ptr).hello();因为它似乎也有效,所以我认为前者只是一种更方便的方式.
->
ptr->hello();
(*ptr).hello();
是这样的情况还是有什么不同?
c++ pointers operators dereference
c++ ×1
dereference ×1
operators ×1
pointers ×1