Mendelsohn, Michael wrote:
Hi list...

I understand what interfaces are, but I'm not entirely clear on when
they become advantageous to use.  Anyone care to shed some light?

Thanks,
- Michael M.

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
Polymorphism for one

class a implements interface{
}
class b implements interface{
}
class c{
var myVar:interface;
function c(instance:a){
myVar = instance;
}
}

Second, keeping yourself in check. Interfaces allow you to dictate the rules for a "breed" of class. An example:

Let's say you're designing an application to keep track on men and women. Your app *needs* a function, say "update" to be in all instances of man and woman, but in the man and woman classes the update functions are so dissimilar there's no point in using inheritance. Instead, implement a "human" interface, which dictates explicitly that both need a uniform update function. Problem solved in terms of type checking, problem solved in terms of keeping yourself on top of why you did what.

To me, interfaces are like inheritance-free polymorphism first, and debug tool second.

- Andreas R
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to