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

前端 未结 4 692
生来不讨喜
生来不讨喜 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:10

    In CSharp, override keyword meaning is totally different from the Java world. The equivalent in Csharp World is explicit implementation but it has a drawback.

    interface IShape
    {
         void Display();
    }
    
    class Square : IShape
    {
         void IShape.Display()
         {
    
         }
    }
    

提交回复
热议问题