Cool.  Thanks.
  -----Original Message-----
  From: Barney Boisvert [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, February 25, 2004 5:30 PM
  To: CF-Talk
  Subject: RE: extends + init() = returntype confusion

  Precisely.  You can access anything in the 'this' scope of the parent CFC.

  > -----Original Message-----
  > From: Andy Ousterhout [mailto:[EMAIL PROTECTED]
  > Sent: Wednesday, February 25, 2004 3:13 PM
  > To: CF-Talk
  > Subject: RE: extends + init() = returntype confusion
  >
  > Interesting.  So if I "override" a component in parent(via
  > Extends), I can use
  > super to still access it the the child?
  >
  > Andy
  >   -----Original Message-----
  >   From: Barney Boisvert [mailto:[EMAIL PROTECTED]
  >   Sent: Wednesday, February 25, 2004 4:38 PM
  >   To: CF-Talk
  >   Subject: RE: extends + init() = returntype confusion
  >
  >
  >   Super references the component that your component extends,
  > and can be used
  >   to call methods and reference public variables (anything in
  > the 'this'
  >   scope) on that component.
  >
  >   If you don't explicitly specify a parent, your component
  > will extend a CFC
  >   in the WEB-INF directory (check the cfcexplorer for
  > details), so super is
  >   always valid.
  >
  >   Super is new in CFMX 6.1, and had some bug with passing
  > variables up.  I'm
  >   not sure of the specifics, as I've yet to really use
  > inheritance in CFCs, as
  >   the scoping rules make it quite troublesome to do effectively.
  >
  >   Cheers,
  >   barneyb
  >
  >   > -----Original Message-----
  >   > From: Andy Ousterhout [mailto:[EMAIL PROTECTED]
  >   > Sent: Wednesday, February 25, 2004 2:26 PM
  >   > To: CF-Talk
  >   > Subject: RE: extends + init() = returntype confusion
  >   >
  >   > Barney,
  >   > This is the first I've seen/heard a "super" qualifier.  What
  >   > does it point
  >   > to/stand for?
  >   >
  >   > Andy
  >   >   -----Original Message-----
  >   >   From: Barney Boisvert [mailto:[EMAIL PROTECTED]
  >   >   Sent: Wednesday, February 25, 2004 4:18 PM
  >   >   To: CF-Talk
  >   >   Subject: RE: extends + init() = returntype confusion
  >   >
  >   >
  >   >   First, IMHO, having init() return a reference to 'this' is
  >   > bad style.  It
  >   >   only makes things more confusing.
  >   >
  >   >   But to answer your question, you should have init() return
  >   > the type of the
  >   >   current CFC.  When you call super.init(), you shouldn't be
  >   > returning.  ALL
  >   >   your init methods should follow this format:
  >   >
  >   >   <cffunction name="init" ... Returntype="typeOfThisCFC">
  >   >     <cfargument ... />
  >   >     ...
  >   >     <cfset var ... />
  >   >     ...
  >   >     <cfset super.init() />
  >   >
  >   >     <!--- any initialization for this object --->
  >   >
  >   >     <cfreturn this />
  >   >   </cffunction>
  >   >
  >   >   Super.init() should ALWAYS be the first thing in the
  >   > method, except for
  >   >   'var' declarations, if you need any.
  >   >
  >   >   Cheers,
  >   >   barneyb
  >   >
  >   >   > -----Original Message-----
  >   >   > From: Jamie Jackson [mailto:[EMAIL PROTECTED]
  >   >   > Sent: Wednesday, February 25, 2004 2:09 PM
  >   >   > To: CF-Talk
  >   >   > Subject: CFC: extends + init() = returntype confusion
  >   >   >
  >   >   > This could be a dumb question, but I'm 2 days into
  > putting CFCs to
  >   >   > real 00 use.
  >   >   >
  >   >   > When you are extending a component (with "extends"), and
  >   > you are also
  >   >   > using the init() function convention, do you need to
  > override the
  >   >   > init() function for all children (in order to get the correct
  >   >   > returntype)? If so, seems you could use introspection in
  >   > the parent
  >   >   > class to dynamically determing the return type, so
  > that each child
  >   >   > would correctly inherit the init().
  >   >   >
  >   >   > So am I off-track? What's the normal way to do it?
  >   >   >
  >   >   > Thanks,
  >   >   > Jamie
  >   >   >
  >   >   >
  >   >
  >   >
  >   >
  >
  >
  >
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to