One way you could do this is force your components to have an init() method.
Then put your <cfthrow> inside this method in the abstract class.
You get around the overhead of calling init() on each component buy building
a kernel component for your application that instantiates each object.
Eg. <cfset myObj =
Application.kernel.createObject('component','com.MyCompany.MyCFC') >
<cffunction name="createObject" >
<cfargument name="type" >
<cfargument name="objName" >
<cfreturn createObject(type,objName).init() >
</cffunction>
Your other advantage here is that you can load application wide params (like
DSN's) into your kernel object and then pass them in to each object as you
create it.
I usually put all of these params inside a struct and pass it to each init()
method.
Pat
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mark Mandel
Sent: Tuesday, 27 July 2004 11:50 AM
To: CFAussie Mailing List
Subject: [cfaussie] CFC Abstract Base Class
Hey all -
Just wondering what the best way to implement a abstract base class,
to ensure that the class cannot be instantiated, but can be inherited
from.
I tried dropping <cfthrow type="com.AbstractBaseClassException"
message="This class cannot be instantiated" > in the top of the cfc,
but that fires when a CFC that extends it is created (which makes a
degree of sense).
So I'm a bit stuck.
Any thoughts?
Mark
--
E: [EMAIL PROTECTED]
W: www.compoundtheory.com
ICQ: 3094740
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/