L
Lucy Ludmiller
I have two classes:
class base { ... };
and
class derived : public base { ... };
I have a function :
void foo(const base*) { ... }
I want to be able to cast back to derived (I only have a ptr to base in
this compilation unit), and then invoke a method on object derived
- do I use a static_cast or reinterpret_cast to cast "upward" ?
- any reason why one is a better choice than the other ?
class base { ... };
and
class derived : public base { ... };
I have a function :
void foo(const base*) { ... }
I want to be able to cast back to derived (I only have a ptr to base in
this compilation unit), and then invoke a method on object derived
- do I use a static_cast or reinterpret_cast to cast "upward" ?
- any reason why one is a better choice than the other ?