In what cases will class A have at most one constructor, taking into account the constructors automatically generated by the compiler? (code using this class may be arbitrary).
The compiler can automatically generate two constructors - the default constructor and the copy constructor. The default constructor is only generated if there are no explicitly declared constructors in this class. A copy constructor is generated if there is an explicit declaration of this constructor. Therefore, a class can have exactly one constructor only if the copy constructor is explicitly declared.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Sign Up Now
or Subscribe for future quizzes