开发者

Does an inherited class automatically implement an Interface from its base class?

开发者 https://www.devze.com 2023-03-12 10:23 出处:网络
Suppose I have piece of code like this: Public Interface ISomething .... End Interface Public Class SomeClass

Suppose I have piece of code like this:

Public Interface ISomething
    ....
End Interface

Public Class SomeClass
  Implements ISomething
    ....
End Class

Now, if I inherit from SomeClass like this:

Public Class InheritedClass
  Inherits Som开发者_StackOverflow社区eClass
    ....
End Class

will InheritedClass automatically implements ISomething, or must I use Implements ISomething in the InheritedClass' definition?


The interface was already implemented by the base class. Your derived class will thus implement it as well since it inherits the base class implementation. If you want to alter the base class implementation then you should declare the implementation method(s) virtual so you can override them.


Yes, the interface will be inherited as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消