An example is worth a thousand words.

public interface IBounce {
   function bounce():void;
}

public class Balls implements IBounce {
   public function bounce():void { }
}

public class Boobs implements IBounce {
   public function bounce():void { }
}

var balls:Balls = new Balls();
var boobs:Boobs = new Boobs();
doSomethingWith(balls);
doSomethingWith(boobs);

function doSomethingWith(bouncyObject:IBounce):void {
   bouncyObject.bounce();
}

Cheers,
Claus.

Omar Fouad wrote:

This could seem weird...
But what the hell is an interface!!!???????? I've read lots of books and
posts without getting the answer. I bought "Essential AS3" to read about
interfaces and he says that helps for multi inheritance. In other places I
read that it is a "deal" to ensure that a class has some methods and so on.
But what is the real benefit that I can come out with using interfaces????

Maybe that is stupidity or I am not smart enough to get the concept but
believe me... its is been two years now!!

Please Help!!!



_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to