Implementation inheritance
- From: ERDI Gergo <cactus cactus rulez org>
- To: gnome-components-list gnome org
- Cc: ORBit/C++ <orbitcpp-list lists sourceforge net>
- Subject: Implementation inheritance
- Date: Sat, 9 Mar 2002 17:11:24 +0100 (CET)
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
`---= cactus cactus rulez org =---'
As a computer, I find your faith in technology amusing.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]