Would someone please give me an example of real world use of interfaces.
Here is what is confusing me. Say I have one dll that has one class called
Messenger and one function called SendMessage. If I suspect that the
implementation of SendMessage may change should I include an interface
(IMessenger) into the dll that defines the SendMessage function? Then have
the class implement it? If I do then should a client call the dll like this:
IMessenger obj = new Messenger();
Now if I add a new class (Messenger2) to the dll that implements the
IMyClass interface with different implementation than MyClass, I will still
have to change all my client code to:
IMyClass obj = new Messenger2();
If I am using interfaces correctly I fail to see how they are useful. Any
help would be appreciated.
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL