I understand aggregates cannot have virtual member functions, yet this code compiles
struct B {
B(int yIn) :y(yIn) {}
int y;
virtual void f() {}
};
B b = {3};
Is brace initialization different than aggregate initialization, or is this class a valid aggregate because of its constructor?
Aucun commentaire:
Enregistrer un commentaire