ansraj91
New member
- Joined
- Oct 1, 2023
- Messages
- 1
- Programming Experience
- 3-5
The below code logically correct but why Visual Studio code is giving compiler errors:
C# Code block giving compilere error:
abstract class Test<A,B> {
private Test<B,object> t1;
public Test(Test<B, object> t) {
t1 = t;
}
}
class Child1 : Test<int, string>
{
public Child1(Test<string, object> t) : base(t)
{
}
}
class Child2 : Test<string,bool>
{
public Child2(Test<bool, object> t) : base(t)
{
}
}
class Achild1
{
public Achild1(object obj)
{
}
}
class Main
{
public void Init()
{
Child2 c2 = new Child2(null);
Child1 c1 = new Child1(c2);
}
}