|
Posted by Gavin Roy on 03/02/05 20:09
Stolen from a oo reference site (who's URL I no longer have handy):
"An object interface--or simply interface--defines methods that can be
implemented by a class. Interfaces are declared like classes, but
cannot be directly instantiated and do not have their own method
definitions. Rather, it is the responsibility of any class that
supports an interface to provide implementations for the interface's
methods. A variable of an interface type can reference an object whose
class implements that interface; however, only methods declared in the
interface can be called using such a variable."
That goes with my understanding as interfaces being one more level of
abstraction from abstract classes. That is they define the rules for
the classes that implement them, but not any code (where an abstract
class can implement code). I guess my understanding of an interface
is wrong?
The reason I want to use an interface is to define a preset definition
of what my classes should implement when they are designed using
specific design patterns.
Gavin
On Wed, 02 Mar 2005 03:17:59 +0100, Jochem Maas <jochem@iamjochem.com> wrote:
> Jason Barnett wrote:
> > Gavin Roy wrote:
> > ...
> >
> >>Is this a bug, or a new intended behavior?
> >>
> >>Gavin
> >
> >
> > To get the long answer you can search through the php.internals list for
> > this topic. The short answer is: this is the new intended behavior.
> >
>
> the short reason(ing) is it doesn't make sense to implement an interface
> on something that isn't an object (i.e. a class). assume object == car, and
> class == idea, an idea can't have a steering wheel interface because its not
> a 'thing' (as such).
>
> if you have a collection of singleton objects that all implement a public
> interface then should those objects be singletons at all?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Navigation:
[Reply to this message]
|