Re: A Good OOP Tutorial/Read?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On May 19, 2013, at 5:19 AM, mrfroasty <mrfroasty@xxxxxxxxx> wrote:

> On 05/16/2013 11:28 PM, Tedd Sperling wrote:
>> So, if you find a good reference, please let me know.
> 
> In my point of view, Interfaces and Abstracts are completely different stuffs not related at all.Interface is a kind of a way of defining how all objects should behave or written by developers (one has used a word contract or agreement).
> 
> For instance we are writting this huge application where hundreds of developers are going to work together.We make an agreement all objects in this application should provide a function for someone debug to see all the contents or data in that object and call this method $this->debug();
> 
> In order to guarantee that developers will have to obey this agreement, the only way is to throw some bunch of exception when they do not.This can be defined in an interface.Where everyone implimenting this interface (creating objects) must have a function called debug().

I understand all of that -- but that's not the question I am asking.

Certainly, I can create an interface and if anyone wants to implement the interface, then they are forced to flesh-out the methods it contains. I understand that -- it's a contract.

But the other side of the argument is why would anyone want to do that other than to meet a design criteria?

It is very easy to understand double inheritance -- it is simply where a child can inherit methods from both parents. But in languages that do not support double inheritance, an Interface is offered as a solution -- and therein is my question.

So, in that regard how does an Interface provide methods to classes that implement the Interface?

Just show me a *simple* example (either php or Java will do).

Cheers,

tedd

PS: There have been people who have provided Interface examples, but none have demonstrated quasi-double inheritance.

_____________________
tedd.sperling@xxxxxxxxx
http://sperling.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux