Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Create Sealed Class Object & call sealed method with non sealed class
//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 SampleClass { public string GetName(string Name) { Console.WriteLine(Name); return Name; } public virtual string GetNameValue(string Name) { Console.WriteLine(Name); return Name; } } public sealed class ChildClass: SampleClass { public override sealed string GetNameValue(string Name) { Console.WriteLine(Name); return Name; } } public class Program { public static void Main(string[] args) { //Your code goes here Console.WriteLine("Hello, world!"); SampleClass sc=new SampleClass(); SampleClass scR=sc; ChildClass cc=new ChildClass(); // Created Object for sealed class sc.GetName("Chinna"); cc.GetNameValue("Selad Method"); // Call Sealed Method scR.GetNameValue("Call Sealed from Non Sealed Class Reference"); // Call 'ChildClass' sealed method from Non selaed Parent class. } } }
run
|
edit
|
history
|
help
0
octalofint
Hallo world
makingNum
Fórum Parallel Threads ( Without Fun )
implement stack
hihi
Sample Linq Test
D16
async example with HttpClient
DAY !