Sadly, that was almost exactly what I had before I pulled it into the
pseudo-constructor, and it still threw the same error.

<cfcomponent displayname="base">
  <cffunction name="init">
    <cfset _hidden = "" />
    <cfreturn this />
  </cffunction>
  <!--- read function --->
</cfcomponent>

<!--- child cfc exactly the same --->

<!--- calling template --->
<set obj = createObject("component", "child").init() />
<dump var="#obj.read()#" />

BZZZT - same error.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of David Ross
Sent: Tuesday, July 06, 2004 2:51 PM
To: [EMAIL PROTECTED]
Subject: Re: [CFCDev] Simple, stupid inheritance/scope issue.


I'm guessing the pseudo-constructor area is not run for the base
component. Put that code in a function (call it init(), please), then
call super.init() upon instantiating the child component.

-dave

>>> [EMAIL PROTECTED] 7/6/2004 2:23:09 PM >>>
I'm sure I'll kick myself shortly, but after spending two weeks trying
and failing to write a cross-browser javascript webservice consumption
class and then a week on vacation in Mexico, apparently my simple CFC
skills have left me entirely. This problem has to do with the
inheritance chain and the unnamed scope. Here's a mockup of the code
I've got.

<-- base.cfc --->
<cfcomponent>
   <cfset _hidden = "" />
   <cffunction name="read" returntype="struct">
      <cfif IsSimpleValue(_hidden)>
         <cfset setValue() />
      </cfif>
      <cfreturn _hidden />
   </cffunction>
</cfcomponent>

<-- child.cfc -->
<cfcomponent extends="base">
   <cffunction name="setValue" returntype="base">
      <cfset _hidden = StructNew() />
      <cfset _hidden.key1 = "value1" />
      <cfreturn this />
   </cffunction>
</cfcomponent>

When I invoke child.cfc and try the read() method, I get an error that
says _hidden is not defined, thrown in the IsSimpleValue() check.

Why? I've defined no arguments so that collision isn't possible, and
I'm
just trying to use the unnamed scope - note that in a prior version of
similar functionality, when all of this is in one cfc, there's no
error
whatsoever. 

Other components I've written use an "instance" structure in the
unnamed
scope, and work just fine. What could possibly be wrong with this
code?

-- 
Eric C. Davis
Programmer/Analyst II
Georgia Department of Transportation
Office of I.T. Applications
Web Applications Group
404.463.2860.199
[EMAIL PROTECTED] 
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words '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 words '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 words '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