Peter,

Maybe I'm missing something... lord knows it's even likely.

My question is this: Because CFCs don't require variable declaration, I generally use my get/set methods to define what variables are available via a bean... hence there's no inheriting of variables to begin with. I would guess this is a fairly CF-specific implementation detail because as I understand it things like C++, Java, and C# require you to declare your instance fields at compile time. Since CF doesn't use compile-time binding but runtime-binding instead, you don't really inherit variables anyway. If you wanted to include a couple methods like paramRequest() and buildDefaultRequest() you could do something like this in your code:

<cffunction name="getRequest">
  <cfif not structKeyExists(variables,"request")>
    <cfreturn buildDefaultRequest()>
  <cfelse>
    <cfreturn variables.request>
  </cfif>
</cffunction>

Then in your subclasses you'd just override the buildDefaultRequest method to build the default request... that way you'd basically be "inheriting" the variable by abstracting that variable from the default code/pseudo-constructor to an actual method that generates the variable in question.

Just some thoughts...

Laterz!

J


On 5/12/05, Peter H <[EMAIL PROTECTED]> wrote:
Hi guys,
 
Its possible to inherit methods but is possible to inherit variables and do they have to be in the THIS scope to be accessible by the sub-class?
 
As an example I have a base class of type Request and two subclasses. One of type PingRequest and a second of type OptionRequest.
 
Each request consists of a series of case-sensitive name/value pairs and each has a validate method. I can add a validate method to my base Request class and override it in my subclasses but how would I add an array of name/value pairs to my base class and override them in my subclass?
 
Cheers, Pete (aka lad4bear)


--
---------------
-------------------------------------
Buy SQLSurveyor!
http://www.web-relevant.com/sqlsurveyor
Never make your developers open Enterprise Manager again. ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

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

Reply via email to