What type of inheritance that PHP supports?

Answer Posted / mahesh

PHP can support single,multilevel,hierarchical and hybrid
inheritance but not multiple inheritence because of diamond problem.
Q:what is diamond problem?
A:suppose "class A extends class B and also class C".
then if class B contains function foo() and class C also contains function foo().if your creates object to the class A
and try to call function foo() then which class function it will take class A or Class B.. in this case diamond problem will be occur.
But we can avoid this problem through "INTERFACE".

Is This Answer Correct ?    12 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is variable give example?

562


How do you remove whitespace from the beginning and end of a $string variable?

508


What is the use of header() function in php?

551


How do I get csrf token?

559


Why would we use === instead of ==?

8357






What is the use of offset in mysql?

530


What is binary safe string?

547


Tell me what library is used for pdf in php?

521


What is difference between explode() or split() in PHP?

496


Why do we use in php?

544


What is a helper function?

548


Do you have to initialize variables in php?

492


Why do we use polymorphism in php?

545


Tell me how do I escape data before storing it into the database?

535


What is php ci?

556