Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Generic 2 parameters hierarchy
//Title of this code //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 GenBase<T,V> { public T tbase; public V vbase; public GenBase() { } public GenBase(T t,V v) { tbase=t; vbase=v; } public GenBase(V v,T t) { tbase=t; vbase=v; } public GenBase(T t) { tbase=t; } public GenBase(V v) { vbase=v; } public void BDisplay() { Console.WriteLine("Base_t: "+tbase); Console.WriteLine("Base_v: "+vbase); } } public class GenDerive<T,V>:GenBase<T,V> { T tderiv; public GenDerive(T t) { tderiv=t; } public GenDerive(T t,V v):base(v) { tderiv=t; } public void DDisplay() { Console.WriteLine("Deriv_t: "+tderiv); Console.WriteLine("Base_v: "+vbase); } } public class Program { public static void Main(string[] args) { GenBase<int,string> gb=new GenBase<int,string>(10,"Hello"); GenBase<string,int> gb2=new GenBase<string,int>("Hello",10); GenDerive<string,int> gd=new GenDerive<string,int>("Hii",10); GenDerive<int,string> gd2=new GenDerive<int,string>(10,"Hii"); gb.BDisplay(); Console.WriteLine(); gb2.BDisplay(); Console.WriteLine(); gd.DDisplay(); Console.WriteLine(); gd.BDisplay(); Console.WriteLine(); gd2.DDisplay(); Console.WriteLine(); gd2.BDisplay(); } } }
run
|
edit
|
history
|
help
0
Find the missing number in an array2
Get UTC time and offset minutes
How to find second largest integer in an array using only one loop?
ref and out
Display the pattern like diamond by using c# for loop
Microsoft Code
FromBase64String
find node in linked list
Can a == true && a == false be true in C#?
1