I was wondering why can't i create something like this ? :
class Abstract_object
{
protected:
virtual void _initialize() = 0;
public:
Abstract_object()
{
_initialize();
}
};
class Object : public Abstract_object
{
protected:
void _initialize()
{
std::cout << "Initate client !" << std::endl;
}
public:
Object () : Abstract_object()
{
}
};
int main()
{
Object* tmp = new Object();
return (0);
}
When i try to compile it, i recieved a unresolved external symbol, which i quite don't understand where it came from : the definition of _initialize is indeed found in the children ... Someone can explain to me what is happening ? =)
i have tried to call _initiate inside the children class, and it did work as intended. But i will have to create multiple class enhancing Abstract class, and i do not want to call _initiate inside each one of them, so i'm looking for a turnaround, if someone have it =)
Thank you guys ! =)
This is the error i got when compiling this : Error LNK2019 unresolved external symbol "protected: virtual void __thiscall Abstract_object::_initialize(void)" (?_initialize@Abstract_object@@MAEXXZ) referenced in function "public: __thiscall Abstract_object::Abstract_object(void)" (??0Abstract_object@@QAE@XZ)