开发者

Interface and an Abstract class? [duplicate]

开发者 https://www.devze.com 2023-03-21 22:13 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Interface vs Abstract Class (general OO)
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Interface vs Abstract Class (general OO)

I want to开发者_开发百科 know the difference between an Interface and an Abstract class ?

I'm so confused about this.

Thanks already.


In an interface you simply define the methods that you are going to implement. In an abstract class you can actually write methods that contain some code. I'm sure this question has been asked a thousand times so look at some of the other posts.


Interfaces define contracts. Abstract classes provide for code reuse. An object interacts with other objects via their contracts (Interfaces). An object shares code with other, related, objects, by inheriting it from an abstract class.

0

精彩评论

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