A
Aryeh.Friedman
Maybe I missing something obvious but there seems to no way to do
somehting like this (yes I know the syntex is illegal):
foo<Integer>()
public <T> T foo()
{
return ack(T this);
}
assume ack returns some instance of T...
How do I pass the type param to to foo?.... everything in the generics
tutorial implies that either it must be defined when the instance is
made and/or T x must be a param:
public Foo<T>
{
public T foo()
{
return ack(this);
}
}
or
public class Foo
{
public <T> T foo()
{
return ack(this);
}
}
This would be ok except if foo() is static there is no actual instance
of Foo (it contains nothing but static methods and the default/only
constructor is private). How do set T at run time (syntatically?)
--Aryeh
somehting like this (yes I know the syntex is illegal):
foo<Integer>()
public <T> T foo()
{
return ack(T this);
}
assume ack returns some instance of T...
How do I pass the type param to to foo?.... everything in the generics
tutorial implies that either it must be defined when the instance is
made and/or T x must be a param:
public Foo<T>
{
public T foo()
{
return ack(this);
}
}
or
public class Foo
{
public <T> T foo()
{
return ack(this);
}
}
This would be ok except if foo() is static there is no actual instance
of Foo (it contains nothing but static methods and the default/only
constructor is private). How do set T at run time (syntatically?)
--Aryeh