I have a virtual class that I use as a base class when inheriting it in other class:
Class looks like this
class Interface
{
public:
std::string name;
virtual ~Interface() = default;
virtual std::vector<std::vector<double>> Calc(std::vector<std::vector<double>> tab) {
return std::vector<std::vector<double>>();
} };
I inherit this class in other class:
class Robot : public virtual robot::Interface
{
public:
IRB6400R_200_280(){...}
std::vector<std::vector<double>> Calc(std::vector<std::vector<double>> tab){...some code...}
};
I initialize the class like this:
Interface myRobot = Robot();
All the properties are initialized correctly. The problem is when I call methods of the myRobot .
When I type myRobot.Calc(...) the Interface method is called. But I need to call the Calc method of the Robot class.
How can I correctly do inheritance and call Calc method from the Robot class not Interface?