Possible Duplicate:
Interfaces: Why can't I seem to grasp them?
I have seen many different types of answers on what is interface (techical, c#) and why is it there.etc..
Today i want to ask you guys question whether below my understanding is correct ?
You will implement an Interface on class A when you want your consumer classes (say classes B,C,D,E) to use class A for a reason (and that reason is Interface name).
Lets say class A has functionality to can Delete Employee work history Data and as well it can delete Employee skillset data. This class A has non null property called Employee_Id
Now you will implement 2 interfaces IDeleteWorkHistroy and IDeleteSkillSet and implement them in class A
All the consumer classes B,C,D... will talk to your class only through these two interfaces and they wont directly use instance of class A anywhere in the application
e.g. in class B wants to delete only employee work history: IDeleteWorkhistory EmpWH = new class A(emp_id); and everywhere else in class B you will use EmpWH and nothing else of class A.
Basically consumers of your class will use only that thing which he needs or other way consumer will talk to that interface which is needed by him.
In other words (keyboard is interface of your Computer) if you want to talk to your computer you wont need a bit sequencer where you you pass bit by bit information to CPU using interrupts..(though , ideally , you can do it). You will talk to your machine using proper interface only.
So any class that you are writing , write proper interfaces so that the consumers will talk to your class in standard way.
Please let me know if my understanding is correct or needs modifications ?