Skip to content
dreamcode
dreamcode
Map
Abstract classes
Lesson 15 of 21
+15 XP on finish
C# INTERMEDIATEChapter 4 · C# Intermediate

Abstract classes

An abstract class is a base class that cannot be instantiated. It can contain both abstract methods (no logic, must override) and regular methods (with logic).

Worked example
abstract class SkyEntity {
    public abstract void Update();
    public void Describe() {
        Console.WriteLine("Sky Entity");
    }
}

class Cloud : SkyEntity {
    public override void Update() {
        // Concrete logic
    }
}

How it reads

  • abstract class prevents direct instantiation of the base class
  • public abstract void Update() has no body and must be overridden
Cloud tip: Unlike interfaces, an abstract class can contain constructors, fields, and default method implementations.

Check your understanding

0 / 2

Answer all 2 to complete this lesson and earn 15 XP.

  1. 1. Can you instantiate an abstract class using the new keyword directly?
  2. 2. What keyword must a subclass use to implement an abstract method?
Answer every question to unlock the next lesson.