So say I have a class
public abstract class Mammal { ... }
public class Wolf : Mammal
{
// concrete methods and
}
But I don't want to do something like:
List<Wolf> myWolfPack = new List<Wolf>();
I sort of want to say:
WolfPack myWolfPack = new WolfPack();
Which means I basically need to write a WolfPack class:
****public class WolfPack : IList<Wolf>
{
// properties, methods that implements IList
// WolfPack-specific methods
}****
The reason I want to do this is because I wolf packs have specific properties (e.g. a leader, an omega).
WolfPack-specific methods
Wolf Leader { get;set; }
Wolf Omega { get;set; }
So here are my newbie questions:
What is this called? Is there a name for wanting to add methods to a collection/list/existing concrete object? If I'm just using a private List inside my WolfPack class, should I instead just say: public class WolfPack : List
? Seems weird to do this with a concrete class, no? Are there any downsides to this?
Sorry if my words are weird.