Let's have following classes parent and child.
class parent
{
public:
void Test(char* pParameter) {};
};
class child : parent
{
public:
void Test(int pParameter) {};
};
How to solve following issue?
child* c = new child();
c->Test("cccc");
It returns: "const char *" is incompatible with parameter of type "int".
I found out these ways:
- Rename method
- Cast c to parent class ((parent*)c->Test("cccc");)
- Create in child class method Test(char*) calling the method in parent class.
I do not like neither one of the solutions. Is there any other?