[英]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? 这个函数及其返回类型发生了什么?
If classname
is one of the arguements of the macro, #classname
is a string version of its value. 如果classname
是宏的参数之一,则#classname
是其值的字符串版本。 So if classname
were SomeType
, #classname
would be the equivalent of "SomeType"
因此,如果classname
是SomeType
, #classname
将等同于"SomeType"
Since it is returning a string (c string) the return type is const char* 因为它返回一个字符串(c字符串),返回类型是const char *
For more information look at Stringification 有关更多信息,请查看字符串化
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.