Thanks Jasper, That makes sense. But what benefit is there is having it as an explicitly "abstract" class? Why can't it just be a "normal" class definition which you inherit from? Sorry to be so dense.... Al > -----Original Message----- > From: Jasper Bryant-Greene [mailto:jasper@xxxxxxxxxxx] > Sent: 23 October 2005 09:19 > To: Alan Lord > Cc: php-general@xxxxxxxxxxxxx > Subject: Re: Abstract Classes? > > On Sun, 2005-10-23 at 08:54 +0100, Alan Lord wrote: > > Hi All, > > > > I have started reading a couple of books about PHP 5 and > whilst most > > of it is comprehensible even to me :-), I fail to > understand WHY there > > is such a thing as an abstract class or method? > > > > I think I understand what it is: A class that can't itself be > > instantiated, only inherited from, or a method that > describes itself > > only in terms of what properties it accepts but no implementation > > detail. > > > > But could someone explain why I would want to use this? I'm > sure it is > > very useful but I can't quite see the benefit... > > Hi Alan > > Here's an example from an application framework I've been working on. > > It has classes to represent the different HTTP response statuses (like > 301 Moved Permanently, 304 Not Modified etc.) with required > and forbidden headers for each and different characteristics > (like no request-body allowed etc). > > I have an Abstract class called HTTP_Response, from which > HTTP_Response_Moved_Permanently, HTTP_Response_Not_Modified, > and many others all inherit. > > The reason HTTP_Response is abstract is because there's no > such thing as an HTTP_Response on its own. It has to be a > specific type of HTTP Response, that is a 301 Moved > Permanently or a 304 Not Modified. > > Does that help? > > -- > Jasper Bryant-Greene > General Manager > Album Limited > > e: jasper@xxxxxxxxxxx > w: http://www.album.co.nz/ > p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303 > a: PO Box 579, Christchurch 8015, New Zealand > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php