W
wij
Hi:
In the class BigInt, the 3rd ctor won't work as desired (accepting lower
level classes).
template<unsigned int Level>
class BigInt {
int m_lo,m_hi;
public:
BigInt() : m_lo(),m_hi() {};
BigInt(const BigInt& s) : m_lo(s.m_lo),m_hi(s.m_hi) {};
BigInt(const BigInt<Level-1>& s) : m_lo(s),m_hi() {};
};
How should I do to for such codes to compile correctly?
BigInt<1> a;
BigInt<5> b(a); // problem in constructing b
In the class BigInt, the 3rd ctor won't work as desired (accepting lower
level classes).
template<unsigned int Level>
class BigInt {
int m_lo,m_hi;
public:
BigInt() : m_lo(),m_hi() {};
BigInt(const BigInt& s) : m_lo(s.m_lo),m_hi(s.m_hi) {};
BigInt(const BigInt<Level-1>& s) : m_lo(s),m_hi() {};
};
How should I do to for such codes to compile correctly?
BigInt<1> a;
BigInt<5> b(a); // problem in constructing b