Jump to content

Multiple inheritance in PHP


renatov

Recommended Posts

Any particular reason? Probably not. But a combination of reasons may play a part, such as

- Rarely ever makes sense in an true OOP sense. When used it generally violates the idea that a class represents an entity by making a class encapsulate functionality, such as adding database connectivity or providing a "default" implementation for an interface.

- Ambiguity of having multiple parents. Like, if two parents both inherit from one single ancestor and each override a particular method, which implementation does a child receive?

- Lack of a need. PHP has traits which allows you to "import" functions into classes as if they were written natively. (The concept is also called "mixins".)

- Awkwardness. How do you refer to a particular parent from a child? parent won't work as-is and you can't use the parent class's name as that looks like a static method call.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.