Reputation: 1240
I have 3 classes (3 files):
a.class.php
b.class.php
c.class.php
I want to extend class a and b in the class c (file 3):
How I could do that? I want to use both class functions of a + b in my new class C
Upvotes: 2
Views: 9889
Reputation: 1334
There is a way of achieving this in PHP using mixins. See this http://www.phpdeveloper.org/news/6139 for example. However I would probably try to find a different way of designing your code so you don't have to use it.
Otherwise PHP 5.4 will bring Traits which will natively support what you want: http://simas.posterous.com/new-to-php-54-traits
Upvotes: 1
Reputation: 1963
You are asking for multiple inheritance, which is not supported by php. You should have a look at composition instead.
Upvotes: 8
Reputation: 181280
There is no multiple inheritance in PHP. So you can't do that.
Try using composition and re-arranging your class structure.
Upvotes: 4