我可以用什么来代替箭头运算符`->`?

2021-12-13 00:00:00 pointers c++

箭头运算符 (->) 的同义词是什么?

What is the arrow operator (->) a synonym for?

推荐答案

以下两个表达式是等价的:

The following two expressions are equivalent:

a->b

(*a).b

(受运算符重载的影响,正如 Konrad 所提到的,但这是不寻常的).

(subject to operator overloading, as Konrad mentions, but that's unusual).

相关文章