An interface says what a class can do, but not how it does it. For example, IDataReader has a Read method that takes no parameters and returns a bool. IDataReader doesn't say how it does the read, but any class that implements IDataReader will have that method. Classes that implement the interface such as SqlDataReader provide the details on how the Read is actually done.
Programming to an interface means that you use the interfaces instead of the classes. Since anything that implements the interface will have the same set of functions and properties, you can do things like substitute the SqlDataReader with an OleDbDataReader with minimal adjustments to your code.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only