mardi 24 avril 2018

C++11 - What is the difference between CTOR() = default and empty CTOR(){}? [duplicate]

This question already has an answer here:

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