overriding virtual function return type differs and is not covariant

后端 未结 6 1710
后悔当初
后悔当初 2020-12-17 23:36

Ah, SO came back just in time.

I am getting a strange error:

 \'B::blah\': overriding virtual function return type differs and is not covariant from          


        
6条回答
  •  独厮守ぢ
    2020-12-17 23:47

    Why is that?

    Simply because the ISO C++ standard committee ruled it that way!

    There is no fundamental reason. It could be done differently, at the cost of a tiny additional compiler complexity.

提交回复
热议问题