Polymorphism and Abstract in C#

Let’s say you want to define a base class that other classes will inherit from:

We want to make sure that everything that inherits from this class will implement its own version of the CreateBrushes() method. If this method isn’t implemented then we will get a runtime exception every time our inherited class is instantiated. This is one way of ensuring that inherited classes provide an implementation of a method. However, we only find out the problem at runtime. A better solution would be to get an error at compile time. This is where the abstract keyword comes in….
Read more →