Home Help Center

Cannot create instance of abstract class

JesusCJesusC Member Edmond SatieOrganization: SalltelProject: Resource Client
Hello everybody,

I have created a slice name "Location.ice" which includes the interface LocationListener:


interface LocationListener {
["nonmutating", "cpp:const"]
idempotent void locateReport(Position pos);

["nonmutating", "cpp:const"]
idempotent void locateSeqReport(PositionSeq pos);

["nonmutating", "cpp:const"]
idempotent void locateRangeReport(PositionSeq pos);

};

And I have created the following implementation in c++ for this interface:

class LocationListenerI : virtual public LocationListener {

private:


public:

LocationListenerI();

virtual void LocationListenerI::locateReport(const Position& p, const ::Ice::Current& c);
virtual void LocationListenerI::locateSeqReport(const PositionSeq& p, const ::Ice::Current& c);
virtual void LocationListenerI::locateRangeReport(const PositionSeq& p, const ::Ice::Current& c);

};
//
void LocationListenerI::locateReport(const Position& p, const ::Ice::Current& c)
{
int i = 0;
}
//
void LocationListenerI::locateSeqReport(const PositionSeq& p, const ::Ice::Current& c)
{
int i = 0;
}
//
void LocationListenerI::locateRangeReport(const PositionSeq& p, const ::Ice::Current& c)
{
int i = 0;
}
//


but when I try to instance the LocationListenerI class, the compiler retrieves the error: "cannot create instance of abstract class 'LocationListenerI'"

I have check all the file 'Location.h' but I don't find the incoherence with the implementation (LocationListenerI) of the class LocationListener.

please, any help?

Comments

  • dwaynedwayne St. John's, NewfoundlandMember Dwayne BooneOrganization: ZeroC, Inc.Project: Internet Communications Engine
    It appears that you are missing the const qualifiers required because of your use of "cpp:const" metadata.
    virtual void LocationListenerI::locateReport(const Position& p, const ::Ice::Current& c) const;
    virtual void LocationListenerI::locateSeqReport(const PositionSeq& p, const ::Ice::Current& c) const;
    virtual void LocationListenerI::locateRangeReport(const PositionSeq& p, const ::Ice::Current& c) const;
    
  • JesusCJesusC Member Edmond SatieOrganization: SalltelProject: Resource Client
    That was it!
    thanks
Sign In or Register to comment.