Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
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
Please
log in
to post a comment.
DateTime change clock
Simple Selection Sort
xx
Splilt Function to retrieve integers
WebScrape using Regex
ray's 2nd test
Strings: Padding Integers and Handling Decimal Float Numbers
Namespace basic
Cotton Farm v: (0.0.0.002)
Unexpected result of virtual method
Please log in to post a comment.