开发者

OO: Can an interface implement another interface?

开发者 https://www.devze.com 2023-02-09 23:52 出处:网络
I know it is language-specific, but is it possible in OO-languages that interfa开发者_运维知识库ces implement other interfaces?in C# you can do:

I know it is language-specific, but is it possible in OO-languages that interfa开发者_运维知识库ces implement other interfaces?


in C# you can do:

interface YourInterface: IDisposable {
   /// your methods
}

and a class wich implements YourInterface shall also implement IDisposable's method.

Of course, then this is valid:

YourInterface implementation = new Implementation();
IDiposable disposable = implementation;


interface can extend but not implement another interface, since there is no implementation in the interface.


Yes, though the term used is "extend" rather than "implement."


In simple words Implementation means applying set of predefined rules.interface is same like this.so an interface can not implement other interface.thats why we extend one interface with other

0

精彩评论

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