Roadmap › OOP Concepts in C# › Module: Interfaces and Abstract Classes
Lessons in this course (15)

11. Sealed classes, virtual, override, base and new

IntermediateMediumLesson 11 of 15
  • virtual — the base method can be overridden.
  • override — replaces a virtual/abstract member.
  • sealed override — stops further overriding down the chain.
  • sealed class — cannot be inherited (e.g. string); also lets the JIT devirtualise calls.
  • base.Method() — call the base implementation from the override.
  • new — hides a base member (rarely what you want; the compiler warns without it).
  • Static methods can't be virtual (except static abstract interface members in C# 11 for generic math).