A nice and easy to understand explanation that I have found in stackoverflow :
An abstract method cannot have functionality. You’re basically saying, any child class MUST give their own version of this method, however it’s too general to even try to implement in the parent class.
A virtual method, is basically saying look, here’s the functionality that may or may not be good enough for the child class. So if it is good enough, use this method, if not, then override me, and provide your own functionality.
p.s. if you override a virtual method, you can always refer to the parent method by calling base
Latest posts by Giorgos Basagiannis (see all)
- What is the difference between an abstract and a virtual method? - November 26, 2017
- Angular 2 News tutorial in Visual Studio Code part 3 - June 28, 2016
- Angular 2 News tutorial in Visual Studio Code part 2 - June 22, 2016