Ok, that makes sense.  So is there an instanceof method in CF or
something similar to tell you what class was used to create your object.

Also, can you create an interface with CFC's, and then implement that
interface with another class?  (Like other OOP languages)

~Brad

-----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. 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:239838
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=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to