is this a variable or function

房东的猫 提交于 2019-11-30 16:36:23

This is a variable declaration. A declaration of the form:

type variablename = value;

is essentially equivalent to:

type variablename(value);

This is the case regardless of what type is - whether it is a user-defined class or a built-in type. Note that the reverse is not always the case - the = syntax requires that there be an accessible copy constructor.

For similar reasons, you can cast arithmetic types using the constructor syntax, as in: x = int(42.0);

It is a variable declaration, and it is equivalent to this:

const int32 alpha = src%size;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!