3 ms·
The rules really aren't that hard for practical use. Of course pedantic rules in the standard are much more complex and corner cases can bite us. If you define
by sqeaky 10y ago
The rules really aren't that hard for practical use. Of course pedantic rules in the standard are much more complex and corner cases can bite us.
If you define no constructors then the compiler will generate a default constructor with no args, a copy constructor, a move constructor and an assignment operator. If any class data members don't have one of those then the class you are writing won't have one either.
The simplest practical rule is define none of them or define all of them. It is not often, perhaps one in ten classes, that you should do something else.
If wind up using C++ for more than a small project, than you ought read up and not use simple heuristics like this.