Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
C# Overriding example using virtual and override keywords
//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) { //Your code goes here Console.WriteLine("Hello, world!"); A a = new A(); a.Method(); B b = new B(); b.Method(); A ab = new B(); ab.Method(); B bc = new C(); bc.Method(); } class A{ public virtual void Method() { Console.WriteLine("A"); } } class B:A{ public override void Method() { Console.WriteLine("B"); } } class C:B{ public void Method() { Console.WriteLine("C"); } } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Single Line Date in Months
One liner recursive prime generator
normalised pagination
A.K.C#_EXPERIENCE_1
combine paths
PC/DDS Discussion
Listas JL
Linked List
world
Get year quarter from date
stackse - search stackoverflow differently
Please log in to post a comment.