[omniORB] Python inheritance and inherited interfaces

Duncan Grisby dgrisby@uk.research.att.com
Tue, 29 Aug 2000 15:31:30 +0100


On Tuesday 29 August, Gary Pennington wrote:

[...]

> However, how should we define the advanced user interface?
> 
> I'm doing this :-
> 
> import basicServer    #Contains python code for implementing basic
> server interface
> ....
> class AdvancedUserImpl(advanced__POA.AdvancedUserIF,
> basicServer.UserImpl): #Inherit first from the generated interface and
> secondly from the basic implementation

Yes, that is a sensible thing to do. I should document the fact that
you must inherit from the skeleton class before any other classes...

The alternative, which may or may not be clearer, is for the Advanced
servant implementation to contain an instance of the Basic servant
implementation, and delegate the Basic server operations to it. That
means that the Advanced implementation class has to have
implementations of the Basic operations, which explicitly call the
contained Basic instance. That leads to more code, but possibly makes
it more obvious what's going on.

Cheers,

Duncan.

-- 
 -- Duncan Grisby  \  Research Engineer  --
  -- AT&T Laboratories Cambridge          --
   -- http://www.uk.research.att.com/~dpg1 --