C ++指针在*和 - >之间的差异。 [英] C++ pointers difference between * and ->
本文介绍了C ++指针在*和 - >之间的差异。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Too坏我不能google这个...
Too bad I can't google this...
有人可以解释或指向我在哪里可以找到这两者之间的区别?我理解*是一个解引用运算符,什么关于 - >?有什么区别?
Could someone explain or point me to where I can find the difference between these two? I understand * is a dereferencing operator, what about the -> ? What's the difference?
推荐答案
a-> b
糖为(* a).b
唯一的特殊情况是对象 - >
当在对象上使用 - >时调用。它可以用于模拟对象是一个指针(如同智能引用)
The only special case is the object operator->
which is called when -> is used on an object. It can be used to "simulate" the object is a pointer ( as with smart references )
这篇关于C ++指针在*和 - >之间的差异。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文