Re: Beginner Tutorials for using CLASSES in PHP4
| From: | Nathan Nobbe | Date: | Thu, 11 Oct 2007 00:45:06 +0000 |
| Subject: | Re: Beginner Tutorials for using CLASSES in PHP4 | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-263076@lists.php.net to get a copy of this message | ||
On 10/10/07, Robert Cummings <robert@interjinn.com> wrote:
>
> What I was really illustrating is how interfaces are syntactic
> sugar only. In my above example what I've really shown is an
> implicit interface :) Since OOP is largely meant to model real
> world things, ask yourself this... when a doctor sews a pig's
> heart into a human, do you think there's an explicit interface
> someplace that checks for compatibility, or does it "just work"
> if the conditions are right. Food for thought, pork in fact ;)
i would look at that as a great example of an interface in action.
the pigs heart has to be compatible with the human body in some
way; they both have the same interface; namely the holes the tubes
connect to. i assume the doctors are the ones who run the interface
compatibility check.
the implementation is different i suppose (im not a biologist, just
guessing here :)) but thats the beauty of an interface; you just get
a contract, not behavior.
-nathan