Re: Combining implementation of two skeletons into a single servant class using inheritance - clarification please




nataraj.gnanavadivel wrote:
Problem:
I want to combine implementation of two skeletons into a single
servant class using inheritance.

You cannot do this in just C++. You need to use a bit of IDL too. In
particular, you say that your two IDL interfaces are called "cFoo" and
"bBar". You should define another interface, say, "Everthing" that
inherits from "cFoo" and "bBar". You could define the "Everything"
interface in the same IDL file as "cFoo" and "bBar", but doing this
exposes an unnecessary detail to client applications. So instead, I
suggest that you define "Everything" in a separate IDL file that
#include's the IDL file(s) that define "cFoo" and "bBar":

#include "file-that-defines-cFoo-and-cBar.idl"
interface Everything : cFoo, bBar { };

Now, you just implement a C++ servant class that implements the
"Everything" interface. When a client gets a reference for the
"Everything" object, the client will be able to _narrow() it to
either a "cFoo" or a "bBar".


Regards,
Ciaran.

.



Relevant Pages