通过创建复制构造函数的方式,我遇到了这个例子:
class MyClass
{
int x;
char c;
std::string s;
};
Run Code Online (Sandbox Code Playgroud)
由编译器复制为:
MyClass::MyClass( const MyClass& other ) : x( other.x ), c( other.c ), s( other.s )
{}
Run Code Online (Sandbox Code Playgroud)
: x( other.x )...与函数标题行在同一行中的含义是什么?它是如何工作的?