简体   繁体   中英

Template variables and the variables that can store template variables

There is two variables

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

I want to this two variables to store another variable like this

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

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

Thank you.

You can use object or dynamic .

Also, if basic<T> inherits from let say basic you will be able to use basic as the variable type.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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