On Tuesday, Mar 25, 2003, at 10:38 US/Pacific, Brad Howerter wrote:
> <!--- work around the problem of there not being a way to access
> 'super'
> --->
> <cfset user_new = new> <!--- sets user_new() as an alias for new() --->
This creates a non-public instance member called user_new and assigns
it a reference to the function user::new (to mix notations!)...
> ************* EMPLOYEE CFC ********************************
> <!--- Call the parent new() function. (works around the lack of
> 'super') --->
> <cfset this.user_new(argumentCollection=arguments)>
...with the code as you have written it, this shouldn't work. You set
the alias (user_new) in the non-public scope but you're trying to call
it here via the public scope. I think user.cfc should have:
<cfset this.user_new = new>
BTW, I think "new" is a terrible name for what is really an init()
function. "new" is a reserved word in Java so this is confusing:
<cfset x = createObject("component","thing")>
<cfset x.new( args )>
Whereas you would say this for creating a Java object:
<cfset x = createObject("java","thing")>
<cfset x.init( args )>
I strongly recommend keeping to the same naming convention and using
"init" for your constructor for consistency.
> <!--- now finish setting the properties --->
> <cfset private.memberNumber = arguments.memberNumber>
> <cfset private.department = arguments.department>
This also shows that 'private' is a misnomer - if these were private,
you could not access them in a derived component. I like the idiom,
just not the name. I'd be inclined to use:
<cfset instance = structNew()>
"instance" is a nice, neutral name that doesn't imply anything other
than 'instance data'.
Sean A Corfield -- http://www.corfield.org/blog/
"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4