Hi,

I have class structures like this:
Qt Code:
  1. class classA
  2. {
  3. ...
  4. classA() //Constructor
  5. {
  6. foo();
  7. }
  8. virtual void foo()
  9. {
  10. //Do nothing
  11. }
  12. ...
  13. };
  14.  
  15. class classB : public classA
  16. {
  17. ...
  18. classB() : classA() //Constructor calls classA constructor
  19. {
  20. ...
  21. }
  22. void foo()
  23. {
  24. //Specific code here
  25. }
  26. ...
  27. };
To copy to clipboard, switch view to plain text mode 

When I create an object of classB, it calls the constructor from classA.
The constructor of classA calls the method "foo()" that is redefined in the classB.
The problem is that "foo()" is executed from classA instead of classB.

Does anyone know how I must do this?

Thanks,