2 ms·
The class I wrote has a non-default constructor and destructor. The idiomatic way to write your class is just: class foo { }; allowing the compiler to sup
by kazinator 7y ago
The class I wrote has a non-default constructor and destructor.
The idiomatic way to write your class is just:
class foo { };
allowing the compiler to supply the default constructor and destructor.
The purpose of the C++11 default mechanism is to request a default implementation of a special function in situations when it would be suppressed. For instance
class foo {
public:
foo(int x); // this will suppress the default constructor
foo() = default; // this requests it back
};