Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 07-06-2007
PeteH PeteH is offline
Registered User
 
Name: Peter Hug
Organization: Warehouse Optimization LLC
Project: APAL
 
Join Date: Oct 2004
Location: Napier, New Zealand
Posts: 26
Interface inheritance problem in VS 2005 EE

I have an ice file like that:

Code:
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:

Code:
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.

Code:
virtual ::std::string ID(const ::Ice::Current& iceCurrent = ::Ice::Current())
{
  return ThingOneI::ID(iceCurrent);
}
What am I doing wrong?
__________________
Peter Hug
Warehouse Optimization LLC (http://www.warehouseoptimization.com)
Reply With Quote
  #2 (permalink)  
Old 07-06-2007
PeteH PeteH is offline
Registered User
 
Name: Peter Hug
Organization: Warehouse Optimization LLC
Project: APAL
 
Join Date: Oct 2004
Location: Napier, New Zealand
Posts: 26
sorry, there was a typo in my code above, the ice file contains:

Code:
module gaga
{
  interface ThingOne
  {
    string  ID();
  };
  

  interface ThingTwo extends ThingOne
  {
    string  Name();
  };
};
__________________
Peter Hug
Warehouse Optimization LLC (http://www.warehouseoptimization.com)
Reply With Quote
  #3 (permalink)  
Old 07-06-2007
benoit's Avatar
benoit benoit is offline
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,564
Hi Peter,

Try changing the following:
Code:
class ThingOneI : public gaga::ThingOne
With:

Code:
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.
Reply With Quote
  #4 (permalink)  
Old 07-06-2007
PeteH PeteH is offline
Registered User
 
Name: Peter Hug
Organization: Warehouse Optimization LLC
Project: APAL
 
Join Date: Oct 2004
Location: Napier, New Zealand
Posts: 26
Bingo! Thanks heaps for that Benoit.
__________________
Peter Hug
Warehouse Optimization LLC (http://www.warehouseoptimization.com)
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem building IceSSL for CS with Visual Studio 2005 Vivien Delage Help Center 4 11-28-2006 09:55 AM
Problem with Interface change! JaneShang Help Center 2 05-09-2005 09:20 AM
Class inheritance problem aroan Help Center 4 01-13-2005 03:25 AM
Servant inheritance dashie Help Center 12 01-10-2005 01:35 AM
Multiple Inheritance problem brian Help Center 4 03-11-2004 08:20 PM


All times are GMT -4. The time now is 12:55 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.