|
-
Sep 8th, 2001, 11:58 AM
#1
Thread Starter
Hyperactive Member
Interfaces and Abstract classes [Resolved]
What is the real difference between an Abstract Class and an Intrerface? When would you use an Abstract Class instead of an Interface? As far as I understand both of them give methods to any class that Extends\Implements them that must be over ridden because neither Abstract Classes nor Interfaces can pass real code or variables or properties. So besides that fact that an Abstract Class can be extended is there any difference between the two of them?
Last edited by CaptainPinko; Sep 27th, 2001 at 11:05 AM.
"There are only two things that are infinite. The universe and human stupidity... and the universe I'm not sure about." - Einstein
If you are programming in Java use www.NetBeans.org
-
Sep 8th, 2001, 01:12 PM
#2
Dazed Member
I think you would use an Abstract class not really as an alternative to an interface(but you could if you wanted to) but to create a generalization. Then you would extend or (subclass) to create an more specific class. it's a little wierd because a class is a model of an abstraction that provides properties and behaviors
for the objects that represent the abstraction. So in reality a class is an abstraction too.
Java does not support multiple class inheritance. Languages such as C++ support multiple class inheritance and this often leads to alot of complexity in the language. I dont like C++ but that is just my opinion. . The class relationships in Java are linear, ruling out multiple implementation inheritance(meaning a subclass inheriting from more than one supper class.) So what Java provides is interfaces which not only allow new type names to be introduced and used polymorphically but also to permit multiple interface inheritance.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|