Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How to find out that the code is written as managed or un-managed code?

1107


Why abstract class is not instantiated in c#?

950


What exactly is serverless?

853


Give 2 scenarios where static constructors can be used?

935


Explain the difference between abstract class and interface.

1173


When can a derived class override a base class member?

901


List some of the common data providers for ado.net framework?

858


What is difference between variable and property in c#?

900


What is generic delegate in c#?

938


What is collection class c#?

924


What is default constructor c#?

972


what is the syntax to inherit from a class in c#?

1022


What is base class in c#?

1010


Is c# difficult to learn?

876


Can you mark static constructor with access modifiers?

986