What is a constructor, and what distinguishes it from an ordinary member function?
Show answer and explanation
A constructor is a special member function selected to initialize an object and establish its invariant; it has the class name and no return type. It initializes base subobjects and data members before its body runs, can be overloaded, explicit, delegated, copied, or moved, and is invoked as part of object initialization rather than on an already constructed object. If construction throws, the complete object's lifetime never begins, but already constructed subobjects are destroyed.
A constructor is a special member function selected to initialize an object and establish its invariant; it has the class name and no return type. It initializes base subobjects and data members before its body runs, can be overloaded, explicit, delegated, copied, or moved, and is invoked as part of object initialization rather than on an already constructed object. If construction throws, the complete object's lifetime never begins, but already constructed subobjects are destroyed.
Connect the conclusion directly to the type, lifetime, ownership, overload-resolution rule, or library contract present in the question. State implementation dependence or a violated precondition explicitly instead of merely guessing output.