both abstract and virtual are going to be override in child class than whats a difference.
is it Virtual method have body and abstract is just a signature ????
is it Virtual method have body and abstract is just a signature ????
Exactly. The point is that virtual methods can be overridden in derived classes, while abstract methods must be overridden. Likewise, a class that has at least one abstract method must itself be abstract, i.e. it cannot be instantiated directly since its implementation is (partially) missing.
Finally, every abstract method is also virtual by implication. virtual
basically just means that the method is dispatched at runtime to the correct class, and so it can be overridden to implement runtime polymorphism.
Abstract means you MUST override it. Virtual means you CAN override it. More or less.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With