C++ calling completely wrong (virtual) method of an object

后端 未结 4 2086
鱼传尺愫
鱼传尺愫 2021-02-19 03:43

I have some C++ code (written by someone else) which appears to be calling the wrong function. Here\'s the situation:

UTF8InputStreamFromBuffer* cstream = foo();         


        
4条回答
  •  攒了一身酷
    2021-02-19 04:14

    I had this issue and the problem for me was that I was storing it in a class member variable. When I changed it to a pointer and involved new/delete, it successfully registered the child class and its function.

提交回复
热议问题