| Abstract Class | Interfaces | |
| Classes defined as abstract may not be instantiated, and any class that contains at least one abstract method must also be abstract. Methods defined as abstract simply declare the method's signature - they cannot define the implementation. | For interface all the methods by default are abstract methods only. So one cannot declare variables or concrete methods in interfaces | |
| In Abstract class we can declare public, private, protected methods & properties | In interface class we can declare only public | |
| Abstract class contain abstract methods and common methods | Interface class all the methods should be an abstract | |
| A class can Inherit only one Abstract class and Multiple inheritance is not possible for Abstract class. | A class can implement many interfaces and Multiple interface inheritance is possible. |
Saturday, March 24, 2012
Abstracts and Interfaces, what's the difference?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment