Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
Understandiing Virtual, Override, New Keyword in C#
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { A obj = new C(); obj.Display(); //((A)obj).Display(); //Your code goes here Console.WriteLine("Hello, world!"); } } public class A { public virtual void Display() { Console.WriteLine("Class A Call"); } } public class B:A { public new virtual void Display() { Console.WriteLine("Class B Call"); } } public class C : B { public override void Display() { Console.WriteLine("Class C Call"); } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
enums with extension method: better
WebScrape using Regex
Ashraf
timeleft
Math 11.0 Finished fracOp
Intuit // C# // listing_4.6 (if_then_else // Shooting on the target)
Fibonacci Modified
merge 2 arrays
datetime
sleep thread
Please log in to post a comment.