Current code:
class A {
// Abstract class
...
};
class B : public A {
// Concrete class
...
};
class C : public B {
// Concrete class
...
};
class D : public C {
// Abstract class
...
};
class E : public A {
// Concrete class
private:
std::deque< std::shared_ptr<A> > m_deque;
public:
E& operator+=( std::shared_ptr<D> temp ) {
m_deque.push_front( temp );
...
}
...
};
When trying to overload the +=
operator I want to push the parameter temp
into the deque m_deque
. The problem is that the types don't match up. How do I push temp
into the deque m_deque
?
I was trying to type cast temp
, but I'm not sure how to type cast to a grandparent class.
Aucun commentaire:
Enregistrer un commentaire