I'm stuck. Coming from C++ I thought this would simply work, but it does not. Can you please give me an advice? I will try to not end up with kind of creation method in each class used for T.
public class A{
private T t_;
public A(){
t_ = new T(); //error
}
}
Also i don't want to have constructor looking like: A(Class classT){ ...
Ideally i would like to have something like this c++ code.
template
class A{
private:
T t_;
public:
A(){}
};
Thanks for help.
解决方案
2575

被折叠的 条评论
为什么被折叠?



