+ 2
A virtual method is a method in a class that can be overridden. A subclass can override this method. Unlike an abstract method, a virtual method does not need to be overridden and has a body. Virtual functions are very useful for methods that don't exactly need implementation by the subclass. Example: Class A { public virtual void myfunc() {} //function without a body } Class B : A{ public override void myfunc() { Console.Println("b"); } } Class C : A{ Void ex() { //some other things } }
19th Feb 2019, 5:44 PM
CodeMStr
CodeMStr - avatar