In the below code,
struct X
{
int a;
int b;
void *ptr;
};
class Base
{
public:
int a;
int b;
void *ptr;
};
class Child : public Base
{
public:
int c;
};
X obj = { 9, 2, malloc(TWOBYTES), };
Base obj1 = { 3, 4, malloc(TWOBYTES), };
Child obj2 = { 8, 4, malloc(TWOBYTES), 10, }; // Error
obj2
does not get initialised
Question:
Why braced-init syntax does not work for Child
class?
Aucun commentaire:
Enregistrer un commentaire