Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why Use Interfaces
Message
Information générale
Forum:
ASP.NET
Catégorie:
Conception classe
Divers
Thread ID:
01278205
Message ID:
01278286
Vues:
26
Seems like a good use would be to create an interface whenever your class is designed
to be subclassed.


Hey, Kevin,

Yeah, as Bonnie said, that would be overkill. There are plenty of instances where you'd build subclasses, and never have interfaces.

Again, think of an interface as a contract - you use an interface when you simply need to work with the abstraction of something. At the risk of repetition, I use the remoting example, because the client piece doesn't have direct access to the back-end customer class. All the client piece needs to know are the function parameters/return values, which is something an interface provides.

This is stretching it a tad, but think of it like an API. (ironic, since the 'I' in API stands for interface) :)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform