Is there any way to achieve multiple inheritance in php?

Posted by Starx on Stack Overflow See other posts from Stack Overflow or by Starx
Published on 2010-05-12T01:17:41Z Indexed on 2010/05/12 1:24 UTC
Read the original article Hit count: 258

Lets say I have a parent class

class parent { }

.....

This parent has three sub class

class child1 { }

class child2 { }

class child3 { }

and these child classes have further smaller parts like

class child1subpar1 { }

class child1subpar2 {

       public function foo() {
          echo "hi";
       }

}

class child2subpar1 { }

class child2subpar2 { }

Now, how to sum this whole up like

class child1 extends child1subpar1, child1subpar2 { }
class child2 extends child2subpar1, childsubpar1 { }

class parent extends child1,child2,child3 { }

I need to execute the methods in its inherited classes and do something like this

$objparent = new parent; $objparent -> foo();

© Stack Overflow or respective owner

Related posts about php

Related posts about php5