-
Notifications
You must be signed in to change notification settings - Fork 1
Virtual Functions
Mario edited this page Sep 6, 2024
·
1 revision
You can mark a method as overrideable with the virtual
keyword.
public virtual void OverrideableMethod() { }
// Then, in the child class:
public override void OverrideableMethod() { }
You can call the parent method with:
base.OverrideableMethod();
You can prevent a method from further being overridden by sealing it.
public override sealed void OverrideableMethod() { }
- Abstract Classes
- Access Modifiers
- Anonymous Methods
- Anonymous Types
- Arrays
- Attributes
- Console I/O
- Constructors
- Const Fields
- Delegates
- Enums
- Exceptions
- Extension Methods
- File IO
- Generics
- Interfaces
- Iterators
- LINQ
- Main
- Null Operators
- Parameters
- Polymorphism
- Virtual Functions
- Reflection
- Serialization
- Strings
- Value Types
- "Base" Keyword
- "Is" and "As"
- "Sealed" Keyword
- nameof expression