template et classe hérité
salut, j'ai une classe de ce genre :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
template <typename T>
class ptr
{
T* m_ptr;
public:
ptr()
: m_ptr(NULL)
{}
ptr(T* p)
: m_ptr(p)
{
}
ptr& operator=(const ptr& p)
{
m_ptr = p.m_ptr;
return *this;
}
} |
et je voudrais faire ca :
Code:
1 2 3 4 5 6 7 8 9
|
class a
{
}
class b : public a
{
}
ptr<a> ptr1;
ptr1 = ptr<b>(new b()); |
mais le compilo veut pas => "binary '=' : no operator found which takes a right-hand operand of type 'ptr<T>' (or there is no acceptable conversion)"
je suis sous vs2010
quelqu'un a une idée?