Code below from section "Accessing attributes and methods: the dot ." in Unit 6.2 needs one change. first_robot.x_position should be changed to first_robot.set_position(1.15) so that a method reaches the private member x_position;
Robot first_robot;
first_robot.name = "Fastbot"; // set an attribute
first_robot.x_position = 1.15;
first_robot.battery = 90;
first_robot.print_name(); // call a method
Hi @zaf1096 , you need to make std::string name; public as shown in the most recent version of class Robot just before the “Accessing attributes and methods…” I suspect that you may have forgot to add the “public” keyword before declaring the member variables.