I am a newbie in C++. I have a project to create a library for my robot. Basically, the main class is ROBOT, then the second levels are: LIGHT, MOTOR. Then, for the LIGHT level, there are the methods: Set_ON_OFF, Set_color, Set_brightness. For the MOTOR level, there are the methods: Set_right_left, Set_power, Set_move_back. So the multi-level class ROBOT is organized like:
ROBOT
- LIGHT
- Set_ON_OFF
- Set_color
- Set_brightness
- MOTOR
- Set_right_left
- Set_power
- Set_move_back
In the main program, I want to call the methods like that:
ROBOT obj_robot;
obj_robot.LIGHT.Set_ON_OFF = 1;
obj_robot.LIGHT.Set_color= 135;
obj_robot.LIGHT.Set_brightness= 75;
obj_robot.MOTOR.Set_right_left= 0;
obj_robot.MOTOR.Set_power= 85;
obj_robot.MOTOR.Set_move_back= 1;
How can I implement such class organization?
Thank you for your help.
Cedric