Interfaces have nothing to do with inheritance (at least not directly)
as I understand them.  Interfaces are special classes that simply define
what other classes must define.  A class that implements an interface
has to define the methods and properties defined in an interface.  An
interface is not used directly, it's, like Ben mentioned, a "contractual
agreement" that a class will contain certain things.  It's useful in a
team coding environment. Interfaces traditionally start with a capital
letter "I" as in IUserView.as.

Jason Merrill 
Bank of America 
Enterprise Technology & Global Risk L&LD 
Instructional Technology & Media

Join the Bank of America Flash Platform Developer Community 

Are you a Bank of America associate interested in innovative learning
ideas and technologies?
Check out our internal  Innovative Learning Blog & subscribe. 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rob
Sampson
Sent: Monday, August 25, 2008 7:01 PM
To: Flash Coders List
Subject: Re: [Flashcoders] A Question that I've been asking for years!!

I'm certainly no expert but as I understand it, an interface is a class
that
is only good for inheriting, never instantiating.
For example - if you were going to write two classes - Baseball and
Softball, you would want a parent class Ball. However, you won't ever
instantiate a Ball, you'll always use one of the subclasses.
Furthermore,
Baseball and Softball both have similar properties (pitch,
circumference,
weight, etc) but those functions are implemented differently between the
two. So instead of making a Ball class and overriding all the methods
both
times, you would make an Interface that they both implement. You haven't
written any code in the interface, just defined that all Ball objects
will
have a pitch method, and a circumference and weight, and the
implementation
is up to them.

So that's all well and good but the real power is that you can use Ball
as a
data type later to refer to either type: myBall:Ball = new Softball().

I hope that helps -


On Mon, Aug 25, 2008 at 3:39 PM, Omar Fouad <[EMAIL PROTECTED]>
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!!!
>
> --
> Omar M. Fouad - Digital Emotions
> http://www.omarfouad.net
>
> This e-mail and any attachment is for authorised use by the intended
> recipient(s) only. It may contain proprietary material, confidential
> information and/or be subject to legal privilege. It should not be
copied,
> disclosed to, retained or used by, any other party. If you are not an
> intended recipient then please promptly delete this e-mail and any
> attachment and all copies and inform the sender. Thank you.
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to