Abstract methods in Non-abstract classes vice versa

abstract, c#

Solution

You cannot declare `abstract` method in non-abstract class. From C# spec:

10.6.6 Abstract methods

(...) Abstract method declarations are only permitted in abstract classes (§10.1.1.1).

Non-abstract method in `abstract` class is a method that do not have to (or sometimes even can't) be reimplemented in derived classes.

They provide some implementation which is independent and the same across all derived classes (when don't mark as `virtual`) or which can be overridden, but has some default behavior (with `virtual` modifier).

That's mainly how abstract classes differ from interfaces (which cannot contain any implementations).

Problem

What is the purpose of defining non-abstract methods in abstract classes and abstract methods in non-abstract classes? What where the useful scenarios for using these?

Original source