in reply to Re: Inherit only few methods from a parent class
in thread Inherit only few methods from a parent class

I tried the the approach expalined by lostjimmy. But when ever I instantiate my complicated class,it opens a transaction(in the new()) and half of the methods depends on that transaction, which I is not useful in my simple class.
Is there any way when I instantiate a complicated/parent class,that the complicated/parent class can detect which simple class is calling them, so that I can add logic to not open the transactions..
  • Comment on Re^2: Inherit only few methods from a parent class

Replies are listed 'Best First'.
Re^3: Inherit only few methods from a parent class
by lostjimmy (Chaplain) on Jul 14, 2009 at 18:14 UTC

    You could simply add a second constructor, in which you can skip opening transactions (e.g. ComplicatedClass::new_no_trans).

    That being said, this design seems like it is going to turn in to a maintenance nightmare.