duanrong3308 2013-06-30 10:44
浏览 41
已采纳

接口与摘要差异的理论解释[关闭]

I need theoritical explanation on the difference between Interface and Abstract class with an example.

Please donot reply any code as I already know that. Am asking in design level.

For Eg: I need to design an application for Automobile industry where they manufacture Car and Bike.

So here AutomobileIndustry is parent class and Car, Bike are Inherited from it.

I need to know what functionalities should be put into Interface and what should be in Abstract class.

  • 写回答

4条回答 默认 最新

  • doufei2662 2013-06-30 10:49
    关注

    In general I like to think of a base class (abstract or otherwise) as what something is, while an interface is what something does. So something is a Vehicle or an Automobile or some such, while what it does is be Drivable or Flyable, etc.

    The base class is a common structure of existence, while the interface is a common contract of expected functionality.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试