The difference between an abstract function and a virtual function in C#? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

The difference between an abstract function and a virtual function in C#?

Damian99Damian99 USAPosts: 116Member

Please explain the difference between an abstract function and a virtual function used in C# and in which occasions each of these used.

Tagged:

Comments

  • DavidMDavidM USAPosts: 342Member

    Extracted from http://stackoverflow.com/a/391492/2606686

    An abstract function can have no 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 function, 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.

Sign In or Register to comment.