| ||Collection Classes - slide 10 : 36|
Specialization of Collections
I want to make my own specialized/extended collection.
Which class should be selected as superclass of my collection class?
The class constructed from Collection<T> is a useful starting point
A class Animal.
A class AnimalFarm - a subclass of Collection<Animal> - testing protected members.
A sample client of AnimalFarm - revealing use of protected Collection<Animal> methods.
Output from sample client of AnimalFarm.
- The protected, virtual methods InsertItem, RemoveItem, SetItem, and ClearItems are called from all relevant methods in Collection<T>
- Overridden members in AnimalFarm control the actual insertions and removals in the collection