Hi,

I've got the following (pseudo) code:

Qt Code:
  1. class A : public QWidget
  2. virutal void foo() = 0;
  3.  
  4. class B : public class A
  5. void foo(){ bar = 1;}
  6.  
  7. class C : public class A
  8. void foo(){ bar = m_fooBar;}
  9.  
  10. ========
  11.  
  12. stack.addWidget(b); //b instance of class B
  13. stack.addWidget(c); //c instance of class C
  14.  
  15. A* a = dynamic_cast<A*>stack.getCurrentWidget();
  16. if(a)
  17. a->foo();
  18. else
  19. // cast failed?
To copy to clipboard, switch view to plain text mode 

Class A is basically the to be implemented interface for the classes B,C ...

It works on the mac (with gcc v401) but fails on my linux box (with gcc v335).
On the latter I have to use static_cast<> to get it working.
Code and .pro file are identical.

I'm a bit clueless at the moment what is going on.
For dynamic_cast RTTI is needed to be enabled, correct? How would I find out if it wasn't.
What cast is actually recommended here? (sort of asking for best practise)

Thanks,

Moppel