Why would you declare a method as "virtual".
What is the benefit in using virtual?
The Virtual Modifier is used to mark that a methodproperty(ect) can be modified in a derived class by using the override modifier.
Example:
class A { public virtual void Foo() //DoStuff For A } class B : A { public override void Foo() //DoStuff For B //now call the base to do the stuff for A and B //if required base.Foo() }
1.4m articles
1.4m replys
5 comments
57.0k users