Actually, that makes perfect sense...and also explains why the Java kids like setting up (constructor) Init() functions for all their cfcs (so they can actually pass in args.) I personally wouldn't hold my breath for overloading though, that seems a little out of ColdFusion's way of dealing with things. I think they like the K.I.S.S. motto.
Thanks for all the answers, I've been wondering about this one for a little while-> Tyler -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Scott Keene Sent: Thursday, July 24, 2003 3:08 PM To: [EMAIL PROTECTED] Subject: RE: [CFCDev] CFC constructors Another thing about constructors (in other languages) is that you can have more than one constructor for creating the object in different ways - this is known as constructor overloading. A basic constructor in Java for a class named MyClass looks like this: public MyClass() This creates an instance of MyClass and takes no parameters. In the same class, I can overload this constructor like this: public MyClass(int i) This creates an instance of MyClass as well, but takes an integer parameter - which we would likely act on inside the constructor's code (set an instance property to the value, etc). So when I go to use MyClass, I can either create it like this: ThisClass = new MyClass() or ThisClass = new MyClass(2) This is useful when you want to be able to create objects in different ways. Constructors can also call each other! In Java, if you don't write a constructor for a class, the compiler will generate one for you. This seems closest to what is happening in CF to me. What we'd need is to be able to create multiple functions with the same name as the Component for emulation of this. Hope I didn't confuse you, Tyler! ---------------------------------------------- I was born and weaned on ColdFusion, so I'm not that aware of constructors. What functionality does a constructor provide that the Camden scope/constructor area doesn't? I've always thought of the constructor area as being another simplification by MM...? -- Scott Keene [EMAIL PROTECTED] ---------------------------------- CFOOP - Object Oriented ColdFusion http://www.cfoop.com -- ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com).
