Can I override a virtual function with a pure virtual one?

前端 未结 2 1368
迷失自我
迷失自我 2020-12-30 21:29

I have three classes: B, D and G. D is a B and G is a D. Both B and

2条回答
  •  温柔的废话
    2020-12-30 21:37

    You asked:

    Can I override a virtual function with a pure virtual one?

    The answer is: Yes, you can. From the C++11 standard:

    10.4 Abstract classes

    5 [ Note: An abstract class can be derived from a class that is not abstract, and a pure virtual function may override a virtual function which is not pure. —end note ]

提交回复
热议问题