I don't think you can protect the variables in the Variables scope in a parent 
component so that child components cannot access them.

I think you are right about the "include" nature of components.

<cfcompnent name="Child" extends="Parent" >

seems to be similar to

<cfcomponent name="Child" >
<cfinclude template="Parent.cfc" >

with the exception that it is OK to declare a function in the Child component with the 
same name as a function in the Parent component.

Jon

>>> [EMAIL PROTECTED] 12/18/03 01:32AM >>>
Hi I have another problem same like Darcey
with scope of variables.

I try to do an inherit component and when I use variables structure all 
of my variables are used too in inherit component.

I must use a specific name structure that I hope another people doesn't 
use it in inherit component to be sure that he can't change my variable 
in first component.

Why variables struct is used in all inherit components and not specific 
to the component ?

It seems that first component is included in the inherit component ? 
right or not ?

Darcey Spears wrote:

> Hi,
> Trying to figure out what I'm doing wrong here.....I'm using this 
> example from Sean's CF Coding Standards:
>
> <cfcomponent>
>
>     <cffunction name="example">
>         <cfset var localVar = "Just in this function" />
>         <cfset variables.nonPublicVar = "Non-public data member" />
>         <cfset anotherNonPublicVar = "Not recommended - use 
> 'variables'" />
>         <cfset this.publicVar = "Public data member" />
>     </cffunction>
>
>     <cffunction name="more">
>         <cfset var localVar = "Different to example localVar" />
>         <cfset var x = variables.nonPublicVar & " set in 'example' 
> above" />
>     </cffunction>
>
> </cfcomponent>
>
> Display CFM page has:
>
> <cfobject name="someVarTest" 
> component="wherestom_working.dirPackage.standards_var_example">
>
> <cfinvoke
>  component="#someVarTest#"
>  method="more">
> </cfinvoke>
>
> I've also tried just a direct invocation of the "more" method:
> <cfinvoke
>  component="wherestom_working.dirPackage.standards_var_example"
>  method="more">
> </cfinvoke>
>
> and no matter what I do with variables.nonPublicVar it just doesn't 
> seem to be defined or available outside the method where it's created. 
> I get an error saying "nonPublicVar is not defined in Variables" every 
> time I try to use it.
>
> I'm running CFMX 6.1 on Windows XP with the default installation.
>
> I must be doing something wrong....but what??? My understanding is 
> that "variables" scope variables are available to all methods in the 
> component in which they are defined.
>
> Thanks for any help you can provide to keep my hair actually attached 
> to my head... =:0
> Darcey
>
>
>
> Darcey Spears
> Q3Studios Collaborative Web Development
> www.q3studios.com 
> 520-360-5425
>
>
> ----------------------------------------------------------
> 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