Reputation: 5
Can someone explain what it is when a pointer is used as the name of the class when adding a method to the class? Something like this:
cMessage *Tic9::generateNewMessage()
Can't find a way to search for that on google and my C++ knowledge is lacking.
Upvotes: 0
Views: 99
Reputation: 283634
It isn't used as the name of the class, it's part of the return type, pure and simple.
That declares a member (of Tic9
) function named generateNewMessage
which takes no parameters and returns a cMessage*
(a pointer). Since it can't be the in-class declaration (which wouldn't be qualified by the class name), presumably it's part of an out-of-class definition of the function (a definition is a declaration).
Or, if a declaration isn't legal in the current context, it's an expression multiplying cMessage
by the result of calling a static member (of Tic9
) function named generateNewMessage
.
Upvotes: 2