ProgrammingVery hardProduct-company placement · C++

How many of these statements about implicitly generated special members in C++11 and later are correct? (i) If a class declares a copy constructor, no move constructor is implicitly declared. (ii) If a class declares a move constructor, its implicit copy constructor is defined as deleted. (iii) A user-declared destructor prevents the implicit declaration of a move constructor. (iv) Declaring any constructor suppresses the implicit copy constructor.

  1. A. 3
  2. B. 2
  3. C. 4
  4. D. 1

Correct answer: A. 3

(i), (ii) and (iii) are correct, which is why an object of a class with only a destructor is copied when moved. (iv) is false: declaring a constructor suppresses only the implicit DEFAULT constructor.

More OOP with C++ and Java questions

Exams that ask this topic