抽象类和接口的真实示例(使用抽象时和使用接口时) [英] Real Examples of Abstract class and Interface (when use abstract and when use interface)

查看:114
本文介绍了抽象类和接口的真实示例(使用抽象时和使用接口时)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Abstract类和接口的实际示例(使用抽象时和使用接口时)

Real Examples of Abstract class and Interface (when use abstract and when use interface)

推荐答案

在此处尝试: ^ ]


一件事,当您进行项目设计时,在需求分析阶段未100%完成,即您预期设计会发生变化在项目生命周期的后期,最好使用Abstract类.因为说您需要在接口中添加方法,那么您已经在实现该接口的所有类中实现了该方法.
但是对于Abstarct类,每个实现类都无需实现.
它们之间有很多区别.关于CP本身的文章不错.看看抽象类与接口
One thing, when you are project design is not 100% complete in requirement analysis phase i e you anticipate design changes at later stage of project life cycle then better to use Abstract class. Because say you need to add on method in you interface then you have implement that mathod in all the classes which are implementing that interface.
But in case of Abstarct class, every implementing class need not to implement that.
There are a lot of differenecs between them. A good article is on CP itself. Have a look Abstract Class versus Interface


这篇关于抽象类和接口的真实示例(使用抽象时和使用接口时)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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