@MustOverride annotation?

后端 未结 7 984
悲&欢浪女
悲&欢浪女 2021-02-12 22:40

In .NET, one can specify a \"mustoverride\" attribute to a method in a particular superclass to ensure that subclasses override that particular method. I was wondering whether

7条回答
  •  南方客
    南方客 (楼主)
    2021-02-12 23:00

    I'm not sure which attribute you're thinking about in .NET.

    In VB you can apply the MustOverride modifier to a method, but that's just the equivalent to making the method abstract in Java. You don't need an attribute/annotation, as the concept is built into the languages. It's more than just applying metadata - there's also the crucial difference that an abstract method doesn't include any implementation itself.

    If you do think there's such an attribute, please could you say which one you mean?

提交回复
热议问题