jeudi 1 février 2018

when should we declare destructor as =delete in c++ [duplicate]

This question already has an answer here:

i have known that a destructor which is declared as delete could not used as

A a;

but could be used as

A*a =new a();

but we could not free the memory by using

delete a;

so when is it recommended or prefered to declare a destructor as deleted?Is there an idiom?

Aucun commentaire:

Enregistrer un commentaire