[orbitcpp-list] Implementation inheritance
Status: Beta
Brought to you by:
philipd
From: ERDI G. <ca...@ca...> - 2002-03-09 16:11:40
|
Loaded with enthusiasm after hearing about Murray's success with ORBit/C++ and the Hello World demo, I jumped on it to play with it. The first thing I wanted to figure out was how implementation inheritance works. So I created a Hello2 interface that extends Hello with a new "foo" method. Without looking at any CORBA docs, the obvious thing to do was: class Hello_impl: public POA_hellomodule::Hello { public: virtual char* helloWorld (const char* greeting) throw (CORBA::SystemException); }; class Hello2_impl: public POA_hellomodule::Hello2, public Hello_impl { public: void foo () throw (CORBA::SystemException); }; This didn't quite work: server.cc: In function `int main(int, char**)': server.cc:25: cannot declare variable `servant' to be of type `hellomodule::Hello2_impl' server.cc:25: because the following virtual functions are abstract: generated/helloworld-cpp-skels.hh:62: virtual char* POA_hellomodule::Hello::helloWorld(const char*) server.cc:26: request for member `_this' is ambiguous generated/helloworld-cpp-skels.hh:51: candidates are: _orbitcpp::stub::hellomodule::Hello* POA_hellomodule::Hello::_this() generated/helloworld-cpp-skels.hh:109: _orbitcpp::stub::hellomodule::Hello2* POA_hellomodule::Hello2::_this() So, I thought, yeah right, I'm duplicating POA_hellomodule::Hello in Hello2_impl since POA_hellomodule::Hello2 is inherited from it. After playing around with every combination of virtual inheritance, I decided to look for 'canonical' answers on the Web. However, the pages I've found all boiled down to my initial solution. So I guess the above code should work, in which case it is ORBit's fault. If it's not, I'd like to hear how you do implementation inheritance. -- .--= ULLA! =---------------------. `We are not here to give users what \ http://cactus.rulez.org \ they want' -- RMS, at GUADEC 2001 `---= ca...@ca... =---' As a computer, I find your faith in technology amusing. |