I have a class that is a base for some other classes. The class has a virtual method, which is supposed to be overridden in the derived classes. This is how it's defined:
protected virtual TableFormat GetFormat()
{
throw new NotImplementedException("Implement the format generator in derived class.");
}
Is this good practice? My boss is telling me that NotImplementedException
should be only used for auto-generated code, but I refuse to conform to that until he gives a reason for it.
Also, this seems like a good place to have an abstract method in a nonabstract class. Why is this not allowed?