mercredi 27 décembre 2017

Using =default in meaning of =delete

The followin code is well compiled:

struct B { 
    B(int) {} 
};

struct D : B {
    D() = default;
};

Until I have to create an instance of class D:

D d; // error: use of deleted function 'D::D()'

Is there any reason (use case) to allow = default for D's constructor, when it's actually works as = delete;?

Aucun commentaire:

Enregistrer un commentaire