I have a class as follows:
Class foo<T>
{
anotherfoo<T>;
foo(){}
foo(foo<T> aFoo)
{ anotherfoo = aFoo; }
}
void main()
{
foo<string> obj1 = new foo<string>();
foo<int> obj2 = new foo<int>(obj1);
}
This time I get an error: cannot convert from foo <string> to foo <int>.
But I need that in this class "foo" another obj foo of a different type, is this possible?
rodolfo
source
share