Is there a way to declare a generic class that extends from its parameter? I want to have a legal equivalent for what I'm trying to do here:
public class Box < T > extends T{
}
Thank you in advance.
Is there a way to declare a generic class that extends from its parameter? I want to have a legal equivalent for what I'm trying to do here:
public class Box < T > extends T{
}
Thank you in advance.
What are you trying to do? Please explain it in more words, because your current code (and explanation) makes no sense, perhaps it is understandable after all once we know the details.
Take your example as example, with type parameter T := Integer.
Then you want to do the following:
Box<Integer> extends Integer
Why would you want that Box<Integer> is a subclass of Integer?
What do you gain with having that behaviour accomplished.
What you are asking is simply not possible in any (OOP) programming language and/or reasoning, and I do not see the need fo rit.