This error is occurring because you are trying to convert a pointer to an object of type 'Robot' to the object itself.

In C++, when you declare a pointer to an object, you need to use the arrow operator (->) to access the members of the object through the pointer.

Here's an example of how you can fix this error:

Robot* robot = new Robot(); // Create a pointer to a Robot object

// Access the members of the object using the arrow operator
robot->someMemberFunction();
robot->someMemberVariable;

// To pass the pointer to a function that expects a reference to a Robot object, you can dereference the pointer using the asterisk (*) operator
someFunction(*robot);

delete robot; // Don't forget to delete the object when you're done with it

Make sure to adjust your code accordingly based on the specific context in which you are using the 'robot' object

66	30	Ddev c++悍将1cpp	Error could not convert robot from Robot to Robot

原文地址: http://www.cveoy.top/t/topic/hNYn 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录