Hi,
I have one header file which uses a virtual function.
This is declared and defined:
#ifndef HeaderH
#define HeaderH
class Base {
<some code>
public:virtual int checkVal(int& val) { return val;}
};
#endif
I have another header file which declares some functions, and inherits from this base header.
Finally, I have the implementation of this header file in another .cpp file: I want to override the virtual function checkVal in my implementation here, but I keep getting a redefinition error.
int Base::checkVal(int& value)
{
if(value == 0)
value = 10;
return value;
}
Is there something I should include in my header file which will override the Base virtual function?