🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Type Casting in C++: all 10 questions

Quiz: Type Casting in C++ · Question 9 of 10

What does the explicit keyword on a single-argument constructor do?

What does the explicit keyword on a single-argument constructor do?

  1. A.Makes the constructor public
  2. B.Forces the constructor to be inline
  3. C.Stops the compiler from using it for implicit conversions
  4. D.Makes the class non-copyable
Answer & explanation

Correct answer: Stops the compiler from using it for implicit conversions

With explicit, pay(500) no longer compiles; you must write pay(Rupees(500)).

Can you get the rest right without peeking?

Take the timed Quiz: Type Casting in C++ quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →