#include <iostream>
class Test
{
public:
Test() : Test(1, 'a')
{}
int geta() { return a; }
char getb() { return b; }
private:
Test(int x, char y) : a(x), b(y)
{}
private:
int a;
char b;
};
int main()
{
Test t;
std::cout << t.geta() << std::endl;
std::cout << t.getb() << std::endl;
system("pause");
return 0;
}
C++11:委托构造
猜你喜欢
转载自blog.csdn.net/qq_41741165/article/details/83653643
今日推荐
周排行