Sunday, January 20, 2013

C++: dot vs arrow

What's the difference?

Basically,
a->b 
is
(a*).b

Dot (.)
  1. can't be overloaded (I'll figure out what that means later)
  2. used to access a member within a derefenced pointer (so, it's pretty much outdated when it comes to pointers)
Arrow (->)
  1. CAN be overloaded (yay)
  2. used to access a member within a pointer


searches:
c++ dot versus arrow
cpp dot arrow

No comments:

Post a Comment