相关疑难解决方法(0)

获取类层次结构中类型的基类

是否可以在类层次结构中获取基类类型?

例如:

struct A{};
struct B{} : public A;
struct C{} : public B;
Run Code Online (Sandbox Code Playgroud)

我想要一些typedef Base<T>::Type内部像这样的模板:

Base<A>::Type == A
Base<B>::Type == A
Base<C>::Type == A
Run Code Online (Sandbox Code Playgroud)

这可能吗?我有多重继承的情况怎么样?

c++ c++11

13
推荐指数
3
解决办法
9602
查看次数

标签 统计

c++ ×1

c++11 ×1