> 2) Interfaces as they exist in java don't really give you much in a stripting > language but if you insist on having something like that you can curently do it > with the zend1. > > class temperature { > function __construct($value) {} > function toCelcius() {} > function toFarenheight() {} > } > > just use that class and extend away.... > > - Brad
Brad, You don't quite get the same functionality from extending a class as you would from implementing an interface. If I'm extending temperature what keeps me as a user from not overriding any of those functions? Or what if I want to extend a different class but still define my class as having those functions found in temperature? Having interfaces is a nice way to skirt the issue of not having multiple inheritance built into the language. Or as my example from before. We have more advanced constructs built into our class library. An automatic database mirror search library, or maybe we want to implement some sort of distributed class heirarchy across multiple servers? It would definetly be more reliable to require certain functions be defined for classes which implement a certain interface rather than assume it is there. And finally if we have a class heirarchy that is already defined and I am creating a new class called UserMenu and extending the class Menu. What if I want to make UserMenu searchable even though the class Menu is not? I can't extend both SearchableObject and Menu. The only way that I can see this working is if there was multiple inheratence or interfaces. You can think of it as inserting an additional branch into the class tree heirarchy. But all of this is doable without having interfaces, it's just that they are one of the easier ways to solve these problems. Ben -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php