Did it possible to cast a generic type of derived class to
generic type of base class?
Answer Posted / lalit pradhan
Good explaination Karthikeyant :)
Also in addition to that the following cast is also not
possible. It will compile but give you casting error on
compile time.
DerivedClassGenrics<int> derivedClassGenrics = new
DerivedClassGenrics<int>();
BaseClassGenrics<int> baseClassGenrics = new
BaseClassGenrics<int>();
derivedClassGenrics = (DerivedClassGenrics<int>)
baseClassGenrics;
Enjoy!!!
Lalit Pradhan a.k.a DOTNET Gadha
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How to find out that the code is written as managed or un-managed code?
Why abstract class is not instantiated in c#?
What exactly is serverless?
Give 2 scenarios where static constructors can be used?
Explain the difference between abstract class and interface.
When can a derived class override a base class member?
List some of the common data providers for ado.net framework?
What is difference between variable and property in c#?
What is generic delegate in c#?
What is collection class c#?
What is default constructor c#?
what is the syntax to inherit from a class in c#?
What is base class in c#?
Is c# difficult to learn?
Can you mark static constructor with access modifiers?