Differences between Interfaces and classes


Following are the notable differences between class and an interface.
Class
Interface
A class describes the attributes and behaviors of an object.
An interface contains behaviors that a class implements.
A class may contain abstract methods, concrete methods.
An interface contains only abstract methods.
Members of a class can be public, private, protected or default.
All the members of the interface are public by default.
A class can only be inherited from a single class
but can be inherited from more than one interfaces.
classes are extended.
Interfaces are always implemented


Comments

Popular posts from this blog

PHP Array Functions

IMPLEMENTATION OF LRU PAGE REPLACEMENT ALGORITHM

Tableau(Line Graphs)