【发布时间】:2013-05-07 15:29:37
【问题描述】:
我发布了一个非常相似的question 并得到了我的答案。我现在面临与构造函数相同的问题.. 如何为 T2 编写构造函数?
template<typename T>
class T1
{
public:
T1(int t) : m_t(t) {}
protected:
int m_t;
};
template<typename T>
class T2 : public T1<T>
{
public:
T2(int t) : m_t(t) {} // error
int get()
{ return this->m_t; }
protected:
};
【问题讨论】:
标签: c++ class templates inheritance constructor