为什么两个都有“。”和“

编程入门 行业动态 更新时间:2024-10-26 16:33:22
本文介绍了为什么两个都有“。”和“ - >” ?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我曾经记得为什么c ++需要两者? 有人可以帮助我吗? 例如 A级{ f(); }; A * aa; 您可以执行aa> f()和或(* aa).f()。那么为什么C ++需要两个运算符呢。 Raj

I used to remember why c++ needed both ? Could somebody help me here ? For example class A{ f(); }; A* aa; You could do either "aa->f()" or "(*aa).f()". So why does C++ need both operators. Raj

推荐答案

" raj" < RA ****** @ hotmail> schreef in bericht 新闻:d7 ************************** @ posting.google.c om ... "raj" <ra******@hotmail> schreef in bericht news:d7**************************@posting.google.c om... 我曾经记得为什么c ++需要两者?有人可以帮助我吗? 例如 A类{ f(); }; A * aa; 你可以做aa> f()和或(* aa).f()。那么为什么C ++需要两个运算符。 Raj I used to remember why c++ needed both ? Could somebody help me here ? For example class A{ f(); }; A* aa; You could do either "aa->f()" or "(*aa).f()". So why does C++ need both operators. Raj

我认为如果xxxx是xxxx,则使用xxxx-> yyyy一个指针 到一个对象/类和xxxx.yyyyy如果xxxx是对象/类

There is a difference I believe that xxxx->yyyy is used if xxxx is a pointer to an object/class and xxxx.yyyyy if xxxx is the object/classs

> A级{ f(); }; A * aa; 你可以做aa> ; f()的"或(* aa).f()。那么为什么C ++需要两个操作符。 f(); }; A* aa; You could do either "aa->f()" or "(*aa).f()". So why does C++ need both operators.

恕我直言,这只是方便。 再见,Marco

raj写道: 你可以做aa> f()和或(* aa).f()。那么为什么C ++需要两个运算符。 You could do either "aa->f()" or "(*aa).f()". So why does C++ need both operators.

第二种形式涉及更多打字,需要更多努力才能阅读。 - Russell Hanneken eu ******* @ cbobk .pbz 使用ROT13解码我的电子邮件地址。

The second form involves more typing and requires more effort to read. -- Russell Hanneken eu*******@cbobk.pbz Use ROT13 to decode my email address.

更多推荐

为什么两个都有“。”和“

本文发布于:2023-11-13 06:32:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1583705.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:都有   两个

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!