Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Polymorphism example
//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 { //Polymorphism class CTPM { public void add(int a,int b) { Console.WriteLine("Addition "+(a+b)); } public void add(int a,int b,int c) { int d=a+b+c; Console.WriteLine("Addition "+d); } } class RTPM { public virtual void display() { Console.WriteLine("Physical memory of RTPM"); } } class MVR:RTPM { public override void display() { Console.WriteLine("Logical memory of RTPM in MVR"); } } public class Program { public static void Main(string[] args) { //complie time polymorphism methods calling CTPM obj=new CTPM(); obj.add(5,4); obj.add(3,9,7); //Runtime Polymorphism MVR obj1=new MVR(); obj1.display(); RTPM r=new RTPM(); r.display(); } } }
run
|
edit
|
history
|
help
0
T
Lottery
rangeofset
Game 1.0.2
xpath select element code
sss0
dxlfkgjdlkgj
JagArray
Print dulicate chars in a string
pause a thread