Mid OOP

Can you instantiate an abstract class?

  • No, abstract classes cannot be instantiated directly.
  • Must be inherited by a derived class which implements abstract methods.

abstract class Shape { public abstract void Draw(); }

// Shape s = new Shape(); // Not allowed

class Circle : Shape { public override void Draw() =>

Console.WriteLine("Circle"); }

More from C# Programming Tutorial

All questions for this course