为什么我们一般在编码频繁更改系统时使用接口? [英] why we generally use interface in coding for frequently change system?

查看:60
本文介绍了为什么我们一般在编码频繁更改系统时使用接口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我们通常在频繁更改系统的编码中使用接口?



当我们创建频繁更改应用程序的系统时一般我们主要使用接口。我们一般在接口中声明方法并在我们的类中定义那些。同时我们从一个类同时继承多个接口。 除了这些原因,如果在频繁更换系统的情况下有任何其他原因使用界面请告诉我。



请告诉我为什么呢?

why we generally use interface in coding for frequently change system?

When we create a system for frequently changing Application generally we use interface mostly.We generally declared the method in the interface and define those in our class.In the same time we inherit multiple interface in same time from a class. besides those reasons, if there is any other reasons to use interface in case of frequently change system please tell me.

and please tell me why?

推荐答案

还有一件事,如果你发现你还需要一个房产,那么在大型应用程序中,

代码或代价,需要在类中声明,而不是在所有类中添加它

你可以简单地在接口中添加它,这样所有继承接口的类都可以拥有它。
One more thing, in big application later if you found that you need one more property,
for say code or price, that need to be declared in class, instead of adding this in all the classes
you can simply add this in interface so all the classes that inherit interface can have this.


.Net不支持多重继承。因此,每当我们想要在多个类上使用相同的功能时,我们就使用接口。
.Net doesn't support multiple inheritance. So, Whenever we want the functionality named the same over multiple classes we use interfaces.


这篇关于为什么我们一般在编码频繁更改系统时使用接口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆