'lo, question for the masses...

I have a group of components that all share a common logic, but due to the
nature of the components, I can't put that common logic in a masterclass,
at the moment I have:

type
  TSharedCode = class(TObject)
  TComponent1 = class(TQuery)
  TComponent2 = class(TADOQuery)
  TComponent3 = class(TSomeMemoryTableComponent)

TSharedCode has a selection of methods and properties that do the actual
grunt code, TComponent1/2/3 create an instance of TSharedCode in their
constructor, and have stub/proxy methods defined, so I have:

procedure TSharedCode.SomeFunction;
begin
  // do stuff
end;

procedure TComponent1.SomeFunction; // this is repeated for each component
begin
  SharedObject.SomeFunction;
end;

This makes for some messy code, having all these little stub functions, so
was wondering if I could use multiple inheritance for this?  like:

type
  TComponent1 = class(TQuery, TSharedCode);

This way, if I add functionality to TSharedCode, its instantly available
to the other classes without adding new stub functions everywhere.

If I had windows/delphi here at home I'd prolly load it up and try it, but
alas no.

Mark

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to