Difference between new and override?

前端 未结 2 702
青春惊慌失措
青春惊慌失措 2021-01-12 20:33

I have a base class which I want to provide some \'base\' functionality for methods for all inheriting classes.

In my inheriting classes I want to do:



        
2条回答
  •  借酒劲吻你
    2021-01-12 20:46

    It says so because you have not declared the base method virtual. Once you do so, the base virtual/derived override pair of keywords will make sense. Right now, the compiler is complaining that you cannot override a non-virtual method.

提交回复
热议问题