This question already has an answer here:
- The new keyword =default in C++11 3 answers
C++11 introduced new keyword default
to force creation of default constructor:
class MyClass {
MyClass() = default; // <==
MyClass(int num);
};
I could not find the reason to use it over empty constructor.
class MyClass {
MyClass() {} // <==
MyClass(int num);
};
Could anybody enlighten me?
Aucun commentaire:
Enregistrer un commentaire