Reputation: 19572
I have a generic class as follows:
class Holder<T>{
int type;
T value;
}
I have a class with method as follows:
class SomeClass<T> {
T insideValue;
??? process();
}
I need from process to return a Holder<T>
. How can I do this? What do I need to change in order to work? I think that if I did:
class SomeClass<Holder<T>> {
it would be the same as class Holder<T>
right?
Upvotes: 1
Views: 110
Reputation: 887469
Very simply:
Holder<T> process();
Closed generic types can be used just like other types (except at runtime).
Upvotes: 4