override
The C# modifier that declares a replacement for an inherited virtual or abstract member, or for methods such as Equals and ToString.
In more detail
The replacement must have the same signature as the member it replaces. The compiler insists on the keyword, and at run time the override on the object's real type is the one that runs.
Related terms
- virtual — The C# modifier for a member that has a working body a derived class may replace with override.
- virtual dispatch — Choosing which method body to run from the object's real type at run time, not from the declared type of the variable.
- GetHashCode — The method that returns a number summarising an object, used by hash-based collections such as Dictionary and HashSet to find it quickly.
Taught in
- Classes, Interfaces, and Object-Oriented C# — Modern .NET Core, C# & Enterprise Microservices