C++ overridden function not called

后端 未结 3 519
攒了一身酷
攒了一身酷 2021-01-28 12:01

I am running into an issue where an overloaded function is not called, and the base function is called instead. I suspect this is related to how things are split between the pr

3条回答
  •  死守一世寂寞
    2021-01-28 12:24

    I am not entirely sure, it is log time since i did c++, but as I remember You should have the vectors contents be classes with pure virtual functions.

    That should force it to look up the right method.

    There is a stack overflow answer here, which is slightly related:

    Pure Virtual Class and Collections (vector?)

提交回复
热议问题