Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Operators in C and C++
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Member and pointer=== {| class="wikitable" style="width:100%" ! colspan="2" rowspan="2" | Operation ! rowspan="2" | Syntax ! rowspan="2" | Can overload ! rowspan="2" | In C ! colspan="2" | C++ prototype |- ! in class K ! outside class |- | {{rh}} colspan="2" | [[Indexer (programming)|Subscript]] | align="center" | <code>a'''['''b''']'''</code><code>a'''<:'''b''':>'''</code><ref>{{Cite web |title=ISO/IEC 9899:1999 specification, TC3 |url=https://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf#%5B%7B%22num%22%3A148%2C%22gen%22%3A0%7D%2C%7B%22name%22%3A%22XYZ%22%7D%2C-27%2C816%2Cnull%5D |at=p. 64, Β§ 6.4.6 ''Ponctuators'' para. 3}}</ref> | {{yes}} | {{yes}} | {{cpp|1=R& K::operator [](S b);}}<br/>{{cpp|1=R& K::operator [](S b, ...);}}<ref name="sinceCXX23" group="lower-alpha" /> | {{n/a}} |- | {{rh}} colspan="2" | Indirection <br>{{small|(object pointed to by ''a'')}} | style="text-align:center;" | <code>'''*'''a</code> || {{yes}} || {{yes}} | {{cpp|1=R& K::operator *();}} | {{cpp|1=R& operator *(K a);}} |- | {{rh}} colspan="2" | Address-of <br>{{small|(address of ''a'')}} | style="text-align:center;" | <code>'''&'''a</code> || {{yes}}<ref name="addressof2" group="lower-alpha"/> || {{yes}} | {{cpp|1=R* K::operator &();}} | {{cpp|1=R* operator &(K a);}} |- | {{rh}} colspan="2" | Structure dereference <br>{{small|(member ''b'' of object pointed to by ''a'')}} | style="text-align:center;" | <code>a'''->'''b</code> || {{yes}} || {{yes}} | {{cpp|1=R* K::operator ->();}}<ref name="arrowptr" group="lower-alpha" /><br /> | {{n/a}} |- | {{rh}} colspan="2" | Structure reference <br>{{small|(member ''b'' of object ''a'')}} | style="text-align:center;" | <code>a'''.'''b</code> || {{no}} || {{yes}} | {{rh}} colspan="2" {{n/a}} |- | {{rh}} colspan="2" | Member selected by [[pointer-to-member]] ''b'' of object pointed to by ''a''<ref name="arrowstar" group="lower-alpha" /> | style="text-align:center;" | <code>a'''->*'''b</code> || {{yes}} || {{no}} | {{cpp|1=R& K::operator ->*(S b);}} | {{cpp|1=R& operator ->*(K a, S b);}} |- | {{rh}} colspan="2" | Member of object ''a'' selected by [[pointer-to-member]] ''b'' | style="text-align:center;" | <code>a'''.*'''b</code> || {{no}} || {{no}} | {{rh}} colspan="2" {{n/a}} |}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)