繁体   English   中英

模板变量和可以存储模板变量的变量

[英]Template variables and the variables that can store template variables

有两个变量

 basic<type1> type_1;
 basic<type2> type_2;

我想要这两个变量来存储另一个这样的变量

basic<type1> type_1;
basic<type2> type_2;

var type = type_1 or type_2 // What type of variable should be declared?

谢谢。

您可以使用objectdynamic

另外,如果basic<T>继承自可以说basic那么您将可以使用basic作为变量类型。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM