C# 2.0, Generic Collection?

  • Thread starter Thread starter rh1200la
  • Start date Start date
R

rh1200la

Hey all. Here's my question. I'm building a Shipping rates component
with the following classes:

Package which contains basic package information. I also have shipper
classes that implement an interface I built. They have basic shipper
information to their respective API's so I will have 3 different
Shipper classes: UPS, FedEx, and USPS. I would like the Package class
to contain a collection of generic shipper objects. I think this is
possible using generics correct? If so can someone point me in the
right direction? Thanks.
 
Very doable. Mark your base class "abstract". Any methods that must be
implemented in the derived classes are also marked "abstract". In your base
class, use protected interfaces for class support routines and public
interfaces for those routines you want to inherit to the derived class's
interface.

Mike Ober.
 
Back
Top