|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
guess you have the following:
class AA; class A { shared_ptr<AA> m_a; }; class BB: public AA; class B { shared_ptr<BB> m_a; }; void g(B* pB); void f(A* pA) { <-- called with a B* // i need to call g() here // }; what would be the best way to do this? |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
..rhavin grobert wrote:
> guess you have the following: > > class AA; > class A { > shared_ptr<AA> m_a; > }; > > class BB: public AA; > class B { > shared_ptr<BB> m_a; > }; > > void g(B* pB); > > void f(A* pA) { <-- called with a B* > // i need to call g() here // > }; > > what would be the best way to do this? You're working with raw pointers here, not the shared_ptr. Do it like you normally would. If you where working with shared_ptrs you would use the pointer casts documented in the boost documentation. |
|
![]() |
| Outils de la discussion | |
|
|