- Standard class that we write our methods
- Cannot contain abstract methods
- Can be used as base class or child class
- Can create object and call methods
- It is declared with the keyword abstract
- Must be used only as a base class. i.e, cannot create object like concrete class
- Cannot create instance of class.
- Can contain abstract methods as well as concrete (standard) methods
Abstract method;
- An abstract member cannot provide any implementation. It is only a method definition.
- You must implement (override) using the keyword override in your child class with your own functionality when you derive the class that contains this method.
- An abstract member is implicitly virtual.
- Can only reside inside an abstract class
Virtual method;
- A method which does something.
- You may either override with your own functionality or not. It is not a must to override.
- It is recommended to use the keyword override when doing so. Because, it will work without the override keyword also.
Sealed class;
- Is used to restrict a class from being inherited.
Sealed method;
- You can only make a method sealed for an overridden method.
- You seal a method to prevent making any changes to it in the derived classes.
No comments:
Post a Comment