Re: A Good OOP Tutorial/Read?

From: Date: Sun, 19 May 2013 14:35:43 +0000
Subject: Re: A Good OOP Tutorial/Read?
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-321130@lists.php.net to get a copy of this message
On May 19, 2013, at 5:19 AM, mrfroasty <mrfroasty@gmail.com> 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@gmail.com http://sperling.com

« previous php.general (#321130) next »