← 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?
- A.Makes the constructor public
- B.Forces the constructor to be inline
- C.Stops the compiler from using it for implicit conversions
- 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 →