The purpose is to imitate an interface.  By making the abstract class's
method throw an error, you are forced to override it in your child class.
If you have the method in the child class, then the fact that the method
exists in the parent is irrelevant, unless you explicitly invoke it wuth a
call to super.

I do this all the time in my classes, because not having interfaces is a
real burden to development.  Certainly not perfect, but it gets most of the
functionality you need.

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Behalf Of Nando
> Sent: Monday, October 27, 2003 11:00 AM
> To: [EMAIL PROTECTED]
> Subject: [CFCDev] Template Method Pattern question
>
>
> Seeing Brendan's post just now reminded me ... I've been reading about the
> template method pattern in Brendan's CFDJ article (thanks much for those
> Brendan!) and am in the middle of putting it to good use. One
> thing that's a
> little baffling is the inclusion of an "Abstract Method" in the parent
> object, the one that throws an error if invoked directly: "This method is
> abstract and needs to be overridden."
>
> Does including an "abstract method" or a method of the same name in the
> parent have any effect on the overall functionality when using
> this pattern,
> or is it in the example just to demonstrate the point that if you call the
> child object that extends its parent, the state and functions of
> the parent
> are available to the child? Wouldn't it function in exactly the
> same way if
> the abstract method was not included in the parent? I'm wondering if i'm
> missing something here.
>
>
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
> in the message of the email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported
> by Mindtool, Corporation (www.mindtool.com).
>
> An archive of the CFCDev list is available at
www.mail-archive.com/[EMAIL PROTECTED]

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to