Multiple choice technology programming languages

What is the maximum number of implicitly defined constructors that this struct will have? struct A { A(A& a) { } A(double d) {} int val; };

  1. 0

  2. 1

  3. 2

  4. undefined

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

When a user-declared constructor is defined, the compiler stops generating the default constructor. This struct has two user-declared constructors: a copy constructor 'A(A& a)' and a converting constructor 'A(double d)'. Because at least one constructor is explicitly declared, the compiler will NOT generate any additional constructors (no default constructor, no copy constructor since one exists, no move constructors). Therefore, the number of implicitly-defined constructors is 0.