in polymorphism using the previous example you could have a cat object with a 'make noise' method that prints 'meow' and a dog object that has a make noise method that prints 'woof woof' - yes this is the same example as in wikipedia!

what makes it polymorphism is that you use the same handler name, your code driving the object says 'make noise' and depending on which animal object you have, you get a different response. This is polymorphism, it isn't Multiple Inheritance

an example of multiple inheritence would be Spock from star trek

Spock is a human

and

Spock is a vulcan

in C++ you can have multiple inheritence and so you can satisfy both conditions. but it causes billions of confusing problems, not least of which being the diamond problem

http://www.javaworld.com/jw-12-1998/jw-12-techniques.html


indeed you are correct because Java's interface type is designed to overcome the problem of multiple inheritence. so with java and AS2 you can have Spock be a vulcan when you need so cold hard rationalism, and have Spock be a human when you need him to give you a hug.

James


At 14:14 25/08/2006, you wrote:
well, I get Interfaces, but thanks for explaining :).

I just don't think actionscript, or java, has any polymorphism,
since the definition of that is, in my opinion, a class having more
than one parent class (ie, can extend 2 or more classes), which
isn't the case. So I don't understand why people who are explaining
oop in actionscript talk about polymorphism, because it just
isn't there :), but perhaps I'm wrong.

cheers,
-Meinte

On 8/25/06, James <[EMAIL PROTECTED]> wrote:

they are different, as far as I know!!!!

an interface, as in 'Interface' type does not itself have an
implementation, whereas a subclass which displays polymorphism does, the
difference comes from your design needs, for example:

(polymorphism)
class animal - can be a implemented class with it's own methods
class dog - is a subclass of animal which alters/extends animal
class cat - is a subclass of animal which alters/extands animal in a
different way to dog

so in certain circumstances you may only need to instance and call methods
in 'animal', when you don't care what it is but just need an animal type.

with Interfaces the 'interface' type is not a implemented object, it does
not have it's own implemented methods

so an example might be if you owned a sports shop that sold coats and
bicycles, coat and bicycle are not the same type but if you get them to
use
the 'stock control item' interface they are both 'stock control item'
objects if you need them to be, providing you follow the rules for that
particular interface you can make any object a 'stock control item' but
there is no generic 'stock control item' type.

see it is different. you have to see things 'arse-ways-backwards'
sometimes
- at first I did not understand the point of interfaces, since the objects
implementing them have to implement the actual working methods anyway but
OOP is about creating a long-term collection of reusable objects which may
be used by teams of coders, structures like interfaces make for a clean
and
clear architecture that other coders can quikly understand, and give a
well
defined way to extend a system.

James


At 12:23 25/08/2006, you wrote:
>going a bit offtopic here, but isnt polymorphism a non-issue in both
flash
>and java? People talk about like there can be such a thing in these
>languages,
>which isn't really true. It seems a bit silly to call something
polymorphism
>just because its implementing some interfaces.
>
>oh well, that probably didn't make any sense i suppose,
>im not getting any decent sleep lately :)
>
>greets,
>Meinte
>
>On 8/25/06, Ricardo Sánchez <[EMAIL PROTECTED]> wrote:
>>
>>Ok, I see its not so easy for everyone. Can anyone point out some
>>tutorial-like examples on internet or books. I know a lot of theory
>>(inheritance, polymorphism...) but I would like to see more applications
>>for
>>it so I can be more confident when I use it.
>>
>>
>>
>>On 8/24/06, slangeberg <[EMAIL PROTECTED]> wrote:
>> >
>> > My main motivation for this stuff in Flash is so that my code
actually
>> > gets
>> > checked by the compiler, vs. Flash's crappy built-in code-checking
for
>>the
>> > stage. That is, it will tell me if I've mis-spelled something,
created
>> > duplicate variables, the list goes on...
>> >
>> > In addition, I write my classes in FlashDevelop, which gives you code
>> > completion. Which means when I start to type:
>> >
>> > > import mx.
>> >
>> > I get a listing of all packages that Macromedia's written, instead of
>> > looking for stuff in the help (that's fun).
>> >
>> > And best yet, when I type:
>> >
>> > var sBigD:ScottsSuperHugeOne = new SuperHuge();  //just a little
>> > poly-morphism thrown in there (huck-huck) ;)
>> >
>> > and I type:
>> >
>> > > sBigD.
>> >
>> > I get a list of every function in my class, as well as its signature
>> > (params
>> > & types).
>> >
>> > I'm only talking about FlashDevelop here. Guess I'm spoiled by Java &
>>.NET
>> > which have instance access to API's at your finger tips (when in the
>>right
>> > IDE's).
>> >
>> > I'm just trying to find a better and efficient way to go. Way open to
>> > suggestions!
>> >
>> > -Scott
>> >
>> >
>> > On 8/24/06, Marcelo de Moraes Serpa <[EMAIL PROTECTED]> wrote:
>> > >
>> > > OOP and Flash is indeed tricky to fully grasp. It has become easier
>>and
>> > > more
>> > > natural to implement OOP techniques on AS3 though.
>> > >
>> > > @Neo: Completely agree with you.
>> > >
>> > > On 8/24/06, neo binedell <[EMAIL PROTECTED]> wrote:
>> > > >
>> > > > I'll tell you a little secret about OOP.
>> > > >
>> > > > Don't sweat it.
>> > > >
>> > > > Sometimes the model jumps out at you but other times you
>> > > > have to find it. How to find it? Write something that does
>> > > > what you want. Then refactor it once you have a better idea
>> > > > of how it works. The more you do that the more certain patterns
>> > > > and approaches crystalise for you.
>> > > >
>> > > > I think there's too much over-engineering going on in general
>> > > > as some people seem to think implementing all the latest patterns
>> > > > on even the smallest project makes them good developers.
>> > > >
>> > > > I've been guilty of it myself a couple of times, writing
frameworks
>> > > > where a couply of focused classes would have sufficed.
>> > > >
>> > > > OOP should be fun if you do it right and don't sweat it when
>> > > > it turns into a dick swinging contest, just make up pattern
names.
>> > > >
>> > > > I quite like the Absolver pattern ;p
>> > > >
>> > > > cheers
>> > > > ~neo
>> > > >
>> > > > -----Original Message-----
>> > > > From: [EMAIL PROTECTED]
>> > > > [mailto:[EMAIL PROTECTED] On Behalf Of
>> > Ricardo
>> > > > Sánchez
>> > > > Sent: 23 August 2006 06:34 PM
>> > > > To: Flashcoders mailing list
>> > > > Subject: [Flashcoders] OOP methodology and flash. I'm loosing my
>> > > faith...
>> > > >
>> > > > ... well, not really but I thought it was good as I title
>> > > >
>> > > > I always use OOP for my flash projects but, even if I find it
easier
>> > > than
>> > > > timeline coding, I dont know if I'm taking all the advantage of
OOP.
>> > I'm
>> > > > not
>> > > > even sure if I am aplying the correct patterns for every problem.
>> > > >
>> > > > My insecurity probably has to do with the lack of normal work OOP
>> > flash
>> > > > examples. For example the typicall top menu/content web. How can
OOP
>> > be
>> > > > applied to that?
>> > > >
>> > > > I guess I find a gap in the theory of knowing how to link the
>>symbols,
>> > > > movieclips, timeline and graphics in flash with the code in
external
>> > > > files.
>> > > >
>> > > > Am I opening a can of worms?
>> > > >
>> > > > Thanks.
>> > > > _______________________________________________
>> > > > 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
>> > > >
>> > > > _______________________________________________
>> > > > 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
>> > > >
>> > > _______________________________________________
>> > > 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
>> > >
>> >
>> >
>> >
>> > --
>> >
>> > : : ) Scott
>> > _______________________________________________
>> > 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
>> >
>>_______________________________________________
>>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
>_______________________________________________
>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

_______________________________________________
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
_______________________________________________
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

_______________________________________________
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