Generic class that inherits its generic type [closed]?

What you are doing defeats the generic objective. How can I just use something like this: Generic intgen = new Generic(); // Impossible The problem is generic defines a behaviour which is type-unspecific. Your generic is type specific since it has to inherit from it.

Generic is used to encapsulate a functionality that cannot be expressed in inheritance while you are mixing the two - and I can tell you it ain't gonna be a good mix.

I don't see the point of the code you provided in Attempt #1. Why would you inherit a class and then pass that same class as generic param. Nevertheless, generic inheritance is supported but its done differently, please check this link, it might give you an idea: Generic Inheritance Hope this helps.

You can't do this because T in the definition of the generic is a type definition and not a real class. I'm not sure what you are trying to accomplish, though, because in my opinion your problem could be solved with a simple inheritance. If you are trying to add some behavior to your class then you can simply use a generic and derive from that: public class Behavior { ... } public class DerivedBehavior : Behavior { ... }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions