samedi 30 mai 2020

Among `dctor,copy ctor and copy assignment operator`, why deletes one and leaves the other to be implicitly-defined will most likely result in errors

As per the documentation(https://en.cppreference.com/w/cpp/language/rule_of_three), which says:

Classes that manage non-copyable resources through copyable handles may have to declare copy assignment and copy constructor private and not provide their definitions or define them as deleted. This is another application of the rule of three: deleting one and leaving the other to be implicitly-defined will most likely result in errors.

As the subject, i wonder why it occurs.Could sombody explain it in more detail? Could somebody make it clear by giving some simple example?

Aucun commentaire:

Enregistrer un commentaire