What to use to access member functions

Started by
2 comments, last by ravyne2001 19 years, 7 months ago
What sould be used to access member functions? With the objects themselves (ex. obj.function()) or with pointers? objPtr->function(). Which is more appropriate?
----Me: So do you know any computer languages?Friend: Ummm....yeah, I used to know l337 talk.Me: ok....
Advertisement
Which ever you have.
if the object is a pointer than you have to use the -> operator. if the object is a stack variable then you use the . operator.
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.

throw table_exception("(? ???)? ? ???");

This topic is closed to new replies.

Advertisement