• Advertisement
Sign in to follow this  

What to use to access member functions

This topic is 4931 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What sould be used to access member functions? With the objects themselves (ex. obj.function()) or with pointers? objPtr->function(). Which is more appropriate?

Share this post


Link to post
Share on other sites
Advertisement
If you have an regular ol' object use .

If you have a Pointer to an Object use ->


The only other option (I believe) would be (*object).method() if you were given a pointer, which is more comlicated, harder to read, more keystrokes not to mention pointless because you already have a perfectly good pointer. I suppose you could also do (&object)->method() given an object, but that's equally rediculous.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement