Why use interfaces in PHP (OOP)


Posted on 16th Feb 2014 07:03 pm by admin

I am learning OOP in PHP and its been a pretty good learning experience so far. What I didn't understand at all is interfaces. I understand the implications of multiple inheritance, and interface is used just to solve that. But what's the use?
If we have to define the function in derived class why use interface, why not directly declare and define it inside the derived class?
Did you know?Explore Trending and Topic pages for more stories like this.
Am I missing something or is it really useless?
No comments posted yet

Your Answer:

Login to answer
79 Like 36 Dislike
Previous forums Next forums
Other forums

DateTimeZone::listIdentifiers headache
http://php.net/manual/en/datetimezone.listidentifiers.php


So the documentation states tha

user data not transferring to new page
I'm a PHP learner. After an index.php page, the user goes to a login.php page. Both pages seem to

A little help in c#
i am doing a simple paint program using c# i want to draw with the mouse so i wrote the code of the

ALV sum various columns problem
Hi all,
I'm doing a report on ABAP for a timesheet of the current month. The output i want is s

a multi dimensional array with for each
hi, I have been asked to write an array, I have Zone 2,3,4,5,6,7,8 each zone has 3 sections of weigh

InternetOpenUrl() Invalid cert
Hi all,

Does anyone know how to prevent calls to InternetOpenUrl() from failing with erro

search function
HI guys,

if anyone could point us in the right direction of how to do this, or provide some t

word wrap in emails help needed
Hello, I understand how wordwrap works in php and have used it well before. However when I used wor

url- go to webpage
i have an input text field and submit button.

how do i make the url entered into the textfiel

Variable Clash
In the past I've had variables clash. For example:

Code: <?php
$c = 5;
$ca

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash