C++ Templates type casting with derivates

后端 未结 4 1378
离开以前
离开以前 2021-01-18 10:10

I\'m trying to cast from one generic to another, say:

myClass anItem = myclass anotherObject;
         


        
4条回答
  •  南笙
    南笙 (楼主)
    2021-01-18 10:49

    Templates in c++ aswell as generics in c++.net are not covariant.

    Check this question, might give you an idea for a workaround.

提交回复
热议问题