Current .Net Version: 1.1.4322
Home
Articles
Practice C# Online
C# Reference
XML Web Services
RSS Feeds
T-SQL Scripts
Videos
Valuable Links
Contact Us
Mike's C#, VS.NET and SQL Blog
ROR XML Info.
C# Reference
The world's largest C# Language & Framework Class Library Reference Database (second only to Microsoft's)!
Language Reference:
Language Search:
Framework Class Library Reference:
Framework Class Library Search:

virtual
Is a:Modifier Keyword
Applies to Version:C# 1.0 and later
Namespace:N/A
Assembly:N/A (N/A)
Description:Declares a property or method as being overridable by a deriving class or struct. A member marked as virtual can have its implementation overriden by a deriving class or struct. You cannot use the modifiers static, abstract and override along with the virtual keyword, and you cannot use the virtual keyword with a static property. Any deriving class must use the override keyword to override a virtual property or method.
Example(s):public class Test1 { public virtual int GetInt() { return 1; } } public class Test2 : Test1 { public override int GetInt() { return 2; } }
 
COPYRIGHT/DISCLAIMER | CONTACT US