Link to home
Start Free TrialLog in
Avatar of farooqam
farooqam

asked on

Should a virtual method in a abstract base class throw?

My abstract base class implements an interface and a method like so:

public interface IFoo
{
       void Bar();
}

public abstract class Foo : IFoo
{
      public virtual void Bar()
      {
          throw new NotImplementedException();
      }
}

Since the base class has no default implementation of this method and I can't make the method abstract, is it reasonable to let the base implementation throw or should it just return? What is the common approach to this? Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial