Is it ok to throw NotImplemented exception in virtual methods?
Posted
by Axarydax
on Stack Overflow
See other posts from Stack Overflow
or by Axarydax
Published on 2010-05-15T19:10:59Z
Indexed on
2010/05/15
19:14 UTC
Read the original article
Hit count: 203
I have a base class for some plugin-style stuff, and there are some methods that are absolutely required to be implemented.
I currently declare those in the base class as virtual, for example
public virtual void Save
{
throw new NotImplementedException();
}
and in the descendand I have a
public override void Save()
{
//do stuff
}
Is it a good practice to throw a NotImplementedException
there? The descendand classes could for example be the modules for handling different file formats. Thanks
© Stack Overflow or respective owner