From the book "The C++ Programming Language - Fourth Edition" on the following pages:
p. 501:
For example:
struct B {B(int); /* ... */ };
struct BB:B {/* ... */ };
struct BBB: BB {
BBB(int i) : B(i) {}; // error: trying to initialize base's base
// ...
};
vs.
p. 491:
But why is the following code allowed, then?
struct Y : X {
X m {0};
Y(int a) : X{a}, m{a} {};
Y() : X{0} {};
}
Aucun commentaire:
Enregistrer un commentaire