struct base {
};
//struct derived { // <--- this one works
struct derived : public base { // <--- but this one doesn't
double x;
};
main () {
derived d{0.5};
return 0;
}
使用大括号进行初始化的方法是什么derived
,这意味着无需显式编写构造函数?
struct base {
};
//struct derived { // <--- this one works
struct derived : public base { // <--- but this one doesn't
double x;
};
main () {
derived d{0.5};
return 0;
}
使用大括号进行初始化的方法是什么derived
,这意味着无需显式编写构造函数?