[For some reason my original post didn't go through (I think because I digitally sign my email). It had a typo anyway, so apologies if the original finally comes through to the list.]
Exactly Right Dave. Joelle, In your base class, add something like this: <cfproperty name="userType" type="string"> <cfparam name="this.userType" default="worker" type="string"> You can set the this.userType upon instantiation and it will know what type it is for the life of the object. Then you can also put in something like this in your base class to search your object hierachy for it's userType or whatever else you'd like to find down the line. <cffunction name="getInstance" returntype="struct" access="public"> <cfargument name="search" type="string" required="no" default=""> <cfscript> var stObj = structNew(); if(len(trim(arguments.search)) GT 0) { for(it in this) { if(arguments.search IS it) { stObj[it] = this[it]; return stObj ; } } } else { for(it in this){ stObj[it] = this[it]; } } return stObj; </cfscript> </cffunction> Warmest Regards, Phillip B. Holmes http://phillipholmes.com =======================> -----Original Message----- From: Dave Watts [mailto:[EMAIL PROTECTED] Sent: Monday, May 08, 2006 12:22 PM To: CF-Talk Subject: RE: Test object type > So I assume that you use session.currentUser to hold EITHER a manager > object OR a worker object. > > This may be a stupid question since I don't have a lot of oop > experience, but is it bad form to use the same variable name to store > two different types of objects? That seems so create the problem you > have now, because you don't know what class you used to instantiate > that object. Actually, being able to use one variable to store different objects can be very useful, and is commonly done in OO languages. However, these tend not to be just any two different objects, but objects that either inherit from the same base class or implement the same interface. For example, you might have a bunch of objects that are sortable. You might write a single interface, ISortable, then write functionality in each class to implement how ISortable works for that specific object type. Then, if you have an array of objects, all of which implement ISortable, you could sort them without worrying about what kind of objects they are exactly. This is a big deal in C# now, with the addition of generics - type-safe collections of various kinds. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:239877 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54