Problem with virtual functions and C++

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Problem with virtual functions and C++

    I have a program running on an atmel SAM4S processor. The program runs out of flash and was originally written in C. I've recently added a small amount of C++. I have a base class that defines a virtual function. A second class extends the base class and redefines the virtual function. The program will not run. It starts but hangs shortly after starting. If I change the code and make the virtual function not virtual (losing the desired functionality), the program runs.


    I've tried a small program that has nothing in it but a base and child class with a virtual function. That small program runs with no problems.


    It appears I'm having a problem with the virtual function pointer table. Any ideas on why my program crashes when using virtual functions?


    Thanks,
    Jim