Re: [PHP] Multiple Class Inheritance

2010-01-27 Thread Nathan Nobbe
On Wed, Jan 27, 2010 at 5:52 AM, Ashley Sheridan wrote: > Hi All, > > I know that a class can only inherit from one other single class in PHP, > but how would I go about simulating a multiple class inheritance? For > example, if I had several small classes that dealt with things like form > genera

Re: [PHP] Multiple Class Inheritance

2010-01-27 Thread Richard Quadling
2010/1/27 Ryan Sun : > 1, you can implement multiple interfaces > > 2, you may want to return object instead of extending classes, > eg. > class Small_Class_Abstract > { >  public function getFormGeneration() >  { >    return new Form_Generation(); >  } > } > class Small_Class_A extends Small_Class

Re: [PHP] Multiple Class Inheritance

2010-01-27 Thread Ryan Sun
1, you can implement multiple interfaces 2, you may want to return object instead of extending classes, eg. class Small_Class_Abstract { public function getFormGeneration() { return new Form_Generation(); } } class Small_Class_A extends Small_Class_Abstract { } $A = new Small_Class_A();

Re: [PHP] Multiple Class Inheritance

2010-01-27 Thread Rene Veerman
Oh, and i'd allow 1 (or _maybe_ 2) "very big" super-class(es) at the top level of a framework / cms, that do include 50-100 smaller classes. "midware" classes can evolve (be extracted) from the superclass, as your app evolves. Try to keep groups of functions relating to as few smaller/lower classe

Re: [PHP] Multiple Class Inheritance

2010-01-27 Thread Rene Veerman
If you want m-inheritance, you can "include" (encapsulate is the word i think) your smaller classes in "midware" and "big top-level" classes that expose (part of) their interfaces. It's easy. But guard against creating too many dependencies between different smaller classes to and "bigger" classes

[PHP] Multiple Class Inheritance

2010-01-27 Thread Ashley Sheridan
Hi All, I know that a class can only inherit from one other single class in PHP, but how would I go about simulating a multiple class inheritance? For example, if I had several small classes that dealt with things like form generation, navbar generation, etc, how could I create a class in which th