Link to home
Start Free TrialLog in
Avatar of -Dman100-
-Dman100-Flag for United States of America

asked on

understanding interfaces

I'm trying to get a better handle on using interfaces.  I have used interfaces that other developers have created, but I have not created an interface.  I understand that they are a collection of methods and also that interfaces can be extended to include other methods.

When you implement an interface, does the order in which you call the methods matter?  For example, as long as I call each method in the interface, does it matter if I call the methods in the same order as defined in the interface or can I call them in any order as long as all the methods are called?

All the interfaces I've worked with contain either void methods with no method  body or methods that return simple types (strings, integers, etc.) with just the return statement.  Can you use methods that return more complex types?  Can the methods contain logic in the method body?

I'm trying to understand the how, when and why of creating an interface in a real-world scenario.  So, if I'm coding a solution, I'd have a better ability to identify when creating an interface would make sense.

Any help on how to better understand using interfaces would be great!
Thanks in advance.
SOLUTION
Avatar of gplana
gplana
Flag of Spain image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial