Skip to main content

Practice ยท 2 of 2

explicit Guards Implicit Conversions

The starter's Meters(int) allows accidental implicit conversions like Meters m = 42;. Mark the constructor explicit (keep the user-defined literal working) so the tests prove conversions require intent.

Difficulty: advanced

Back to lesson: Practice: Initialization Traps