I know the concepts of Abstract Class and Interface Class. But I want real time example which explains both the concept in our design. Can anyone help with this?
2条回答 默认 最新
- duanlei2458 2016-08-03 06:32关注
Here I am mentioning some point what we can do with abstract class and interface
- In abstract class you can define abstract methods which should be public or protected. but in Interface you can define public abstract method only.
- In abstract class you can define data members and constants but in interface you can define constants only.
- In abstract class you can define body of method and you can inherit in sub class, but in interface you can not define body of method.
- you can implement multiple interface in a sub class, but you can not inherit multiple abstract classes in a sub class.
Example
In Major Frameworks, uses interfaces for different types of data source class. If we want to make data source class for new introduced database then we must have to implement their interface in our class so it make well maintained code and methods parameters.
解决 无用评论 打赏 举报
悬赏问题
- ¥15 yolov8边框坐标
- ¥15 matlab中使用gurobi时报错
- ¥15 WPF 大屏看板表格背景图片设置
- ¥15 这个主板怎么能扩出一两个sata口
- ¥15 不是,这到底错哪儿了😭
- ¥15 2020长安杯与连接网探
- ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
- ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
- ¥16 mybatis的代理对象无法通过@Autowired装填
- ¥15 可见光定位matlab仿真