i agree... just wanted to know how it can be done On Fri, Apr 2, 2010 at 9:45 PM, Fabio Maulo <[email protected]> wrote:
> possible is possible but take care about what mean INHERITANCE in OOP. > > Animal > / \ > Cat Dog > > Cat is a Animal > Dog is a Animal > Cat is not a Dog and never will be a Dog > Dog is not a Cat and never will be a Cat > Cat and Dog are different Types of Animal > > A PoorGuy can will be a RichGuy and a RichGuy can will be a PoorGuy: Poor > and Rich are not different Type of Guy instead it is a state. > > The same is for Employee... in this case more than a state we can talk > about a role (may be). > > 2010/4/2 nadav s <[email protected]> > >> lets say i have Employee which is a concrete class with the properties >> Id >> Type >> >> and i have CoolEmployee and MoronEmployee that extend Employee >> >> now i have many employee types and i want type=1 to generate CoolEmployee >> and type=2 to generate MoronEmployee. >> there are alot of other possible values, for instance, 3 is manager and 4 >> is Cleaning guy, and i want all of these other values to generate the >> Employee class >> >> Do i need an extra column to discriminate between the classes or can i >> somehow say that Employee is the default class of a not-found value and use >> the type column? >> >> (i don't have a mapping because it is just a theoritical question :) ) >> >> btw, another thing i was wondering about but couldn't google an answer is >> if it is currently possible to set range of values for discrimination >> (similar to the previous question) >> lets say that i have the sub classes RichGuy, PoorGuy both extend Guy >> and i wanna have the RichGuy subclass generated when the Income column is >> more than 1,000,000 >> if the Income is between 10,000 to 1,000,000 its just a Guy >> and less than 10,000 is a PoorGuy >> >> could this be mapped? >> i see a big problem with this scenario because if the Income property is >> updatebly by the application, we could have a PoorGuy that his Income just >> became >> high enough that he should become just a Guy >> but if the Income property isn't updatebly it might make sense >> >> again, it is just a theoretical question. >> >> thanks. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "nhusers" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<nhusers%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/nhusers?hl=en. >> > > > > -- > Fabio Maulo > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
