Sealed method in C#

后端 未结 7 1699
萌比男神i
萌比男神i 2020-12-13 13:15

I am a newbie in C#.I am reading about Sealed keyword.I have got about sealed class.I have read a line about Sealed method where we can make Sealed method also.The line was

7条回答
  •  清歌不尽
    2020-12-13 13:38

    C# has it because Java has an identical feature (final methods). I've never seen a legitimate use.

    If you don't want to permit extension, the whole class should be marked sealed and not just one method.

提交回复
热议问题