J
Jock
Hi all,
Could anybody suggest what should be the return type of the method Create in
the Factory class?
In Java I would have used the wildcards, but here in C# apparently there is
no way do do it?!?
public class B<T>
{
}
public class D1 : B<int>
{
}
public class D2 : B<float>
{
}
public static class Factory
{
public static B<?> Create(string _name)
{
if (_name.Equals("D1"))
{
return new D1();
}
else
{
return new D2();
}
}
}
Jock
Could anybody suggest what should be the return type of the method Create in
the Factory class?
In Java I would have used the wildcards, but here in C# apparently there is
no way do do it?!?
public class B<T>
{
}
public class D1 : B<int>
{
}
public class D2 : B<float>
{
}
public static class Factory
{
public static B<?> Create(string _name)
{
if (_name.Equals("D1"))
{
return new D1();
}
else
{
return new D2();
}
}
}
Jock