Tuesday, July 23, 2013

Hand a parameter at a constructor's signature to a base class in C#.

namespace Whatever
{
   public class Chihuahua : Dog
   {
      protected Chihuahua(List<Flea> fleas) : base(fleas)
      {
         
//do something here
      }
   }
}

 
 

If the base class does not have a parameterless constructor you will be have to do something like this to have a new class inherit from the base class.

No comments:

Post a Comment