Take the 2-minute tour ×

I started learning OOP applied to C++. Now I want to know if I am required to read a entire section of a book about PHP's OOP or just to adapt some little things?

Are there major differences between these two languages or subtle ones that will occur in a proeminent maner?


share|improve this question
Same concepts apply - inheritance, interfaces, public, private, protected, instance vs static properties. Syntax differs. C++ supports multiple inheritance, PHP does not -- that may be the biggest difference. –  Michael Berkowski Mar 26 '12 at 2:03
no friend classes –  tereško Mar 26 '12 at 2:37
add comment

closed as not constructive by Ben Lee, Ignacio Vazquez-Abrams, thetaiko, Dagon, tereško Mar 26 '12 at 2:37


2 Answers

up vote 2 down vote accepted

Generally the only difference is that while it is a good idea to make abstract classes and interfaces in C++/Java, you don't really need to do so nearly as much in a dynamic language such as php, because you are not limited by types. Although it may still be a good idea even if to simply document the code, a lot of times it just adds to the mess.

And as of recent php update, you can use mix-ins (traits).

share|improve this answer
add comment

OOP is OOP and the language cant change the basic concepts of OOP. In PHP, i think only the difference of inheritance differs as it dont support multiple inheritance like java left all concepts stands same and only syntax changes.

share|improve this answer
add comment
