9.3. Test Yourself: Translating Basic UML to C++

Think you've got the conversion process down? Try converting each line of the following UML class into C++. As you convert each part of the UML diagram, check yourself by hovering the mouse pointer over the text of each line, beginning with "Car," to see the corresponding C++ code.

Car
 -model : string
 -wheels : int
 -engine_size : double
 +vin : string
 +Car(a_name : string, a_wheels : int, a_engine_size : double)
 +get_model() : string
 +is_running() : bool
 +set_wheels(num_wheel : int) : void
 +accelerate(fuel_rate : int) : double
 -diagnostics(system : char) : int


Press "Next" below to see the complete C++ class.