D
DKode
Ok,
here is another question I have that is sort of unrelated to my last
posting about composition.
I have three Collection classes:
EmployeeCollection
HourCollection
InfractionCollection
all three of these classes inherit from ArrayList and will have
Add/Item/Remove methods.
I noticed in the documentation that in the arraylist class, the Item
method returns an object. Would I override the Item method to return
the correct type of class. Then i run into the problem that I notice
that the Add method of the arraylist class takes an input parameter of
type object, so would i also need to override this method to pass the
specific class type that i want to add to the arraylist or would I
just add an item to the arraylist as type object and then cast it to
the particular type when I use the Item method?
I have another example of the following classes:
Hour
Infraction
these two classes will share quite a few identical methods such as:
AddHour, AddInfraction, EditHour, EditInfraction etc..
I have created a base class for these two classes called HIDetailBase
which will contain the Add, Edit methods, now I am in the same boat as
my first question, what is the proper way to override/overload the
methods to get the functionality i require.
Any help would be greatly appreciated. thank you
here is another question I have that is sort of unrelated to my last
posting about composition.
I have three Collection classes:
EmployeeCollection
HourCollection
InfractionCollection
all three of these classes inherit from ArrayList and will have
Add/Item/Remove methods.
I noticed in the documentation that in the arraylist class, the Item
method returns an object. Would I override the Item method to return
the correct type of class. Then i run into the problem that I notice
that the Add method of the arraylist class takes an input parameter of
type object, so would i also need to override this method to pass the
specific class type that i want to add to the arraylist or would I
just add an item to the arraylist as type object and then cast it to
the particular type when I use the Item method?
I have another example of the following classes:
Hour
Infraction
these two classes will share quite a few identical methods such as:
AddHour, AddInfraction, EditHour, EditInfraction etc..
I have created a base class for these two classes called HIDetailBase
which will contain the Add, Edit methods, now I am in the same boat as
my first question, what is the proper way to override/overload the
methods to get the functionality i require.
Any help would be greatly appreciated. thank you