QT-ITK-VTK-Help
QT-ITK-VTK-Help

Reputation: 558

What is the return type of this function?

I got this line into a macro definition of a class

virtual const char *GetEventName() const
{
    return #classname;
}

What is happening in this function and its return type?

Upvotes: 1

Views: 118

Answers (1)

Karthik T
Karthik T

Reputation: 31952

If classname is one of the arguements of the macro, #classname is a string version of its value. So if classname were SomeType, #classname would be the equivalent of "SomeType"

Since it is returning a string (c string) the return type is const char*

For more information look at Stringification

Upvotes: 4

Related Questions