I am fairly comfortable with that concept and created a mini-app yesterday based on Hal's example of employees each having different work() methods for their position that overrode the employee object work() method. Here is where I get kind of hung up is this...
Say I have the following code, and say that each of the objects I am instantiating below extends "employee", and within each object there is only a work() method that represents the work that is done by that position. The rest of the properties and methods are inherited from "employee" object.
<cfscript>
aEmployees = arraynew(1);
dave = createObject("component","cfc.programmer").init();
dave.setemployeeID(createUUID());
dave.setFirstName("Dave");
dave.setLastName ("Shuck");
dave.setHireDate("3/2/2004");
aEmployees[1] = dave;
jane = createObject("component","cfc.projectManager").init();
jane.setemployeeID(createUUID());
jane.setFirstName ("Jane");
jane.setLastName("Doe");
jane.setHireDate("2/15/2000");
aEmployees[2] = jane;
bob = createObject("component","cfc.marketingPerson").init();
bob.setemployeeID (createUUID());
bob.setFirstName("Bob");
bob.setLastName("Marketer");
bob.setHireDate("10/15/1999");
aEmployees[3] = bob;
</cfscript>
If I wanted to loop through that array and only do something [example: persist the data] to employees that were type "programmer", how would that best be accomplished in code?
~Dave
On 12/7/05, Steve Bryant <
[EMAIL PROTECTED]
> wrote:
Here is my best example (if my example is wrong, please somebody let me know):
DataMgr
DataMgr_Access is a DataMgr (for MS Access)
DataMgr_MSSQL is a DataMgr (for MS SQL Server)
DataMgr_MySQL is a DataMgr (for MySQL)
DataMgr_PostGreSQL is a DataMgr (for PostGreSQL)
Each of these inherits behavior from the parent object, but extends
that behavior for the specifics of that database.
http://www.bryantwebconsulting.com/cfcs/
Hope that helps!
Steve Bryant.
Bryant Web Consulting LLC
http://www.BryantWebConsulting.com/
http://steve.coldfusionjournal.com/
At 10:28 AM 12/7/2005, Dave Shuck wrote:
>One of the concepts that I read about, and I understand from the
>thousand foot view is making use of "types" of objects, but I am
>having a hard time with translating that to what it means in
>code. In the example, of the AJ Foyt Car Center (or something like
>that), they would only accept vehicles of type "sportsCar", given
>that sportsCar extends "car" and car extends "vehicle". Does anyone
>have a code example of something like that? I realize that once I
>see it it will likely seem glaringly obvious, but for some reason I
>am just having a hard time visualizing that code in a real implementation.
>
>Thanks,
>
>--
>~Dave Shuck
><mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
> www.daveshuck.com
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting ( www.cfxhosting.com).
An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
--
~Dave Shuck
[EMAIL PROTECTED]
www.daveshuck.com ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).
An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
