我发布了一个非常相似的问题并得到了答案。我现在面临与构造函数相同的问题。如何为 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:
};