假设我有以下课程:
template <class T>
class Base {
protected:
T theT;
// ...
};
class Derived : protected Base <int>, protected Base <float> {
protected:
// ...
using theInt = Base<int>::theT; // How do I accomplish this??
using theFloat = Base<float>::theT; // How do I accomplish this??
};
在我的派生类中,我想引用Base::theT
一个在派生类中更有意义的更直观的名称。我使用的是 GCC 4.7,它很好地覆盖了 C++ 11 的特性。有没有办法使用using
语句来完成我在上面的示例中尝试的这种方式?我知道在 C++11 中,using
关键字可用于别名类型以及例如。将受保护的基类成员带入公共范围。有没有类似的机制来给成员起别名?