Does an inherited class automatically implement an Interface from its base class?
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.
精彩评论