Inheritance from two parent classes

I read about it many centuries ago, but I have never tried it now, I can’t remember whether it is possible or not. Is it possible to extend the class from two parents to php5, for example.

class_d extends class_c and class_b

Alternatively, you can do this if class_c and class_b are themselves extended from class class_a ... so you get something like this

                          class_a
                  class_b          class_c
                          class_d
+3
source share
2 answers

multiple inheritance (what you are looking for) is not supported in PHP.

You can check composition (where one class contains an instance of the parent) or even interfaces if this is specific to your situation.

+3
source

All Articles