About the "->" operator.... (Lecture 59)

Ben, just started to watch this section and at the beginning I saw that you are referring to “->” as “the other operator”. So I started to wonder about the name of that operator, and I didn’t remmeber or found one? So I am not totally sure if there is a “name” for that notation/operator, but based on what that operator is actually doing, which is a dereference, I think we can say it’s an object/class dereference operator? Example doing this: GetOwner()->GetName(); is the same as doing this: (*GetOwner()).GetName(); So it is clear with the “->” operator we are dereferencing the class to access the function member GetName(), in a “fancy way”, or a “more readable” way; but the compiler actually does the dereferencing for us, Right?

Its official name is surprisingly just the arrow operator, but you’re right in what it’s doing.

1 Like

Privacy & Terms