Can an abstract class be redefined in a derived class without implementation in a base class

I have an abstract class A with one abstract method.

This class is inherited by another class B , which should not implement an abstract method.

Now another class C must inherit from class B and implement the method defined in class A

How can i do this?

+4
source share
1 answer

You will need to mark class B as an abstract class if it does not implement all the abstract members of its base class. Then just override, as usual, in class C

Example:

 public abstract class A { public abstract void DoStuff(); } public abstract class B : A { // Empty } public class C : B { public override void DoStuff() { Console.WriteLine("hi"); } } 
+11
source

All Articles