Archived
This forum has been archived. Please start a new discussion on GitHub.
Cannot create instance of abstract class
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?
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?
0
Comments
-
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;
0 -
That was it!
thanks0