If class C implements interface I, and object o is an instance of C, then the 
expressions "o is C" and "o is I" are true. This means that o can be passed to 
any code that expects either a C or an I; it satisfies both types at once! 
Generally you use the interface I to express the public "contract" of what the 
object can do, and the class C to implement the details.

Implementing multiple interfaces makes this even cooler. You might have a 
library of code that deals with carbon emissions and works with 
ICarbonEmitters, and a library that works with IVehicles and does 
transportation scheduling algorithms. If you had a Car class that implemented 
both ICarbonEmitter and IVehicle, then either library could work with an 
instance of Car.

Gordon Smith
Adobe Flex SDK Team

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of Dan Pride
Sent: Wednesday, April 28, 2010 1:12 PM
To: Flex Coders
Subject: [flexcoders] Implement question



What is the practical difference between implementing an interface (Like say 
IResponder) and passing in a variable typed as IResponder in the construction 
method?
Thanks
Dan Pride

Reply via email to