troubleshooting Question

An object of abstract class cannot be created

Avatar of gagajanice
gagajanice asked on
C++
9 Comments1 Solution905 ViewsLast Modified:
hi,

when i try to compile my source code, i get this error:

"/development/demusr/osrc/hello_02/hello_02-0.0.0/libsrc/CustRegister.cxx", line 6.44: 1540-1107 (S) An object of abstract class "CustLoaderFactory" cannot be created.
"/development/demusr/include/SdkTargetFactory.h", line 44.21: 1540-1112 (I) "TargetFactory<TsfLoader>::createCondition(char *, const void *)" is a pure virtual function.
"/development/demusr/include/SdkTargetFactory.h", line 58.25: 1540-1112 (I) "TargetFactory<TsfLoader>::getTargetObj(char *, const void *)" is a pure virtual function.
"/development/demusr/include/ObjectCollector.h", line 55.23: 1540-1112 (I) "ObjectCollector<TsfLoader>::createInstance(const char *, const void *)" is a pure virtual function.
"/development/demusr/include/ObjectCollector.h", line 56.22: 1540-1112 (I) "ObjectCollector<TsfLoader>::reuseInstance(TsfLoader *, const char *, const void *)" is a pure virtual function.
"/development/demusr/osrc/hello_02/hello_02-0.0.0/libsrc/../include/CustRegistration.h", line 15.40: 1540-0202 (S) An expression of type "void *" is not allowed on the left side of "->".

Appreciate if you can advise on this with some explaination.
Thank you in advance.
header file
===========

#ifndef _CUSTLOADERFACTORY_H_
#define _CUSTLOADERFACTORY_H_

#include <TsfLoader.h>
#include <SdkTargetFactory.h>
#include <ObjectCollector.h>

class CustLoaderFactory : public TargetFactory<TsfLoader>
                                                        ,public ObjectCollector<TsfLoader>
{
    public:
        virtual int createCondition(char *condition, void *entity_type);
        virtual TsfLoader *getTargetObj(char *condition, void *entity_type);
        virtual TsfLoader *createInstance(const char *condition, void *entity_type);
        virtual int reuseInstance(TsfLoader *instance, const char *condition, void *entity_type);
};
#endif

source file
===========

#include <CustomerCard.h>
// Included all customized loader classes headers here
#include "CustLoaderFactory.h"

//entity_type is passed in as a string for now
CustLoaderFactory::createCondition(char *condition, void *entity_type)
{
    strcpy(condition, (char *)entity_type);
    return 0;
}

TsfLoader *CustLoaderFactory::getTargetObj(char *condition, void *entity_type)
{
    return getObject(condition, entity_type);
}

TsfLoader *CustLoaderFactory::createInstance(const char *condition, void *name)
{
    TsfLoader *obj = NULL;
    if (strcmp(condition, ENTITY_TYPE_CARD) == 0)
        obj = new CustomerCard();
    else
        obj = NULL;

    if ( obj )
        OTraceDebug("D-CUSTTSF-0001: Create Instance[%s]\n", condition);
    else
        OTraceError("F-CUSTTSF-0002: Unknown Object Name[%s]\n", condition);

    return obj;
}

int CustLoaderFactory::reuseInstance(TsfLoader *instance, const char *condition, void *entity_type)
{
    return 0;
}
ASKER CERTIFIED SOLUTION
evilrix
Senior Software Engineer (Avast)

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros