Archived
This forum has been archived. Please start a new discussion on GitHub.
Interface inheritance problem in VS 2005 EE
in Help Center
I have an ice file like that:
I get a compile error stating that ThingTwoI is an abstract class if I do this:
If I add the following public member function to ThingTwoI, all works fine.
What am I doing wrong?
module gaga
{
interface ThingOne
{
string ID();
};
interface ThingTwo
{
string Name();
};
};
I get a compile error stating that ThingTwoI is an abstract class if I do this:
class ThingOneI : public gaga::ThingOne
{
public:
virtual ::std::string ID(const ::Ice::Current& iceCurrent = ::Ice::Current());
};
class ThingTwoI : public virtual gaga::ThingTwo, public virtual ThingOneI
{
public:
virtual ::std::string Name(const ::Ice::Current& iceCurrent = ::Ice::Current());
};
If I add the following public member function to ThingTwoI, all works fine.
virtual ::std::string ID(const ::Ice::Current& iceCurrent = ::Ice::Current())
{
return ThingOneI::ID(iceCurrent);
}
What am I doing wrong?
0
Comments
-
sorry, there was a typo in my code above, the ice file contains:
module gaga { interface ThingOne { string ID(); }; interface ThingTwo extends ThingOne { string Name(); }; };0 -
Hi Peter,
Try changing the following:class ThingOneI : public gaga::ThingOne
With:class ThingOneI : virtual public gaga::ThingOne
If you don't specify virtual inheritance, you end up with 2 instances of gaga::ThingOne and as you discovered it doesn't work
.
Cheers,
Benoit.0 -
Bingo! Thanks heaps for that Benoit.0