Is there something in c# similar to java's @override annotation?

前端 未结 4 693
生来不讨喜
生来不讨喜 2021-02-18 23:48

I\'ve used the @Override in java and has come in quite handy. Is there anything similar in c#?

4条回答
  •  走了就别回头了
    2021-02-19 00:09

    In C#, you must use the override keyword to override functions.

    If you use override without a matching virtual or abstract base function, you'll get a compiler error.

    If you don't use override, and there is a matching base function, you'll get a compiler warning (unless you add new).

提交回复
热议问题