I have a base and derived class and the base class is abstracted as it has a pure virtual function in it and this function has been implemented in derived class.
But i am not able to create the object and no error is showing up , i am using Xcode in mac and the compilation is failing and nothing is showing up.
i am not able to create an object of type derived with base pointer , also i am not able to create an object of derived class directly too
#include <iostream>
class myApp
{
public:
void Startup()
{
//Template Method
initialize();
if(!validate())
altInit();
}
virtual bool validate() const = 0;
virtual void altInit();
//private:
void initialize()
{
std::cout << "INIT \n";
}
};
class myDerApp : public myApp
{
public:
virtual bool validate() const
{
std::cout << "myDer Validate \n";
return 1;
}
virtual void altInit()
{
std::cout << "myDer INIT \n";
}
};
int main(int argc, const char * argv[])
{
myApp *abc = new myDerApp();
myDerApp obj1;
}
Please advise.
The only error is
clang:-1: linker command failed with exit code 1 (use -v to see invocation) Regards
Aucun commentaire:
Enregistrer un commentaire