Interface is technique or concept which is used to add set of behavior or functionality to be mandatory. When we derive into class then class has to implement each thing that is in Interface. Something like making skeleton and then giving different look and behavior using that skeleton. Decoupling of object and its implementation is possible because of interface.
Lets say you create interface of Cycle
Interface ICycle {
void Handle(); void Wheels(); }
Inheriting class
class AtlasCycle: ICycle { void ResizableHandle() {... } void fourDiaWheels() {.... } }
Above cycle skeleton can be used to derive any brand of bicycle with different feature values.
- Interface has by default all fields, properties and methods Public. But you can have internally private and use it appropriately inside interface.
- One which is public has to be implemented in inheriting class So it better than having base class.
- Class can inherit as many as interfaces So structures can also use interfaces.
- Interface does not have implementation only declarations.
- It is highly used to design architecture. So it is architecture job to define what to be exposed and what not to client.
Happy Programming..
Number of View :5133Related posts:
- Difference Between Abstract Class And Interface In Java Abstract Class Vs Interface When To Use An Abstract Class And An Interface
- Concept Of Session In J2EE Session Tracking In J2EE Session Management Seesion Concept Servlet Basics Servlet Guide Session Tracking
- Understanding the Object Oriented Programming
- How To _access Function For Long File Names As Path In Winddows Programming Use UNC
- Life Cycle Of A Servlet Explained Handling Servlet Life-Cycle Events Servlet Life Cycle Servlet Interview Questions Java Servlet Programming
This entry was posted on Monday, April 1st, 2013 at 8:23 pm and is filed under microsoft, OOPS, software, Tech-Tips, Tips & Tricks. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.