Multiple inheritance + virtual function mess

后端 未结 6 810
灰色年华
灰色年华 2020-12-02 23:50

I have a diamond multiple inheritance scenario like this:

    A
  /   \\
 B     C
  \\   /
    D

The common parent, A, defines a virtual fu

6条回答
  •  囚心锁ツ
    2020-12-03 00:08

    You cannot enumerate the definitions of fn() in the ancestry. C++ lacks reflection. The only way I can imagine is a giant loop testing the typeid's of all possible ancestors. And it hurts to imagine that.

提交回复
热议问题