Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Overriding
//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 ParentClass { public int Method1(int a, int b) { Console.WriteLine(a+b); return a+b; } public virtual string Method2(string name) { Console.WriteLine("Parent Class Method2 Virtual : " + name); return name; } } public class ChildClass:ParentClass { public int Method1(int a, int b) { Console.WriteLine(a*b); return a*b; } public override string Method2(string name) { Console.WriteLine("Child Class Method2 Override : " +name); return name; } } public class Program { public static void Main(string[] args) { //Your code goes here Console.WriteLine("Hello, world!"); ChildClass cc=new ChildClass(); ParentClass pc=cc; cc.Method1(3,4); //call ChildClass Method1 pc.Method1(5,4); // call ParentClass Method1 with ParentClass Reference with ChildClass Object pc.Method2("Chanti"); // // Call ChildClass Method2 after define override in ChildClass. cc.Method2("Chinna"); // Call ParentClass Method2 with out define override in ChildClass. cc.Method2("Chinna"); // Call ChildClass Method2 after define override in ChildClass. } } }
run
|
edit
|
history
|
help
0
obraek
Linked List with basic functions.
Vídeo01 - Classe e Método
BRHOOM 111
2. Basic types: List
Find 20 business days prior to today's date c#
Problem_binary
basics of generics
Enumerable expansion
Метод catch b try в словарях