inheritance in ActionScript 3

Jun 28, 2010 17:26

@ ActionScript 3: The Language of Flex A Conversation with James Ward, Part I

James Ward:
In ActionScript 3, you can do prototype-based classes, just as you can in JavaScript. In Flex, we hide that because we prefer the other style of object-orientedness: creating classes and extending them in the typical Java-like way. If you wanted to, you could get to the prototype stuff, and still do things through the prototype, though.

Object-oriented programming in ActionScript

AS 1.0
Instead of using a class keyword to create an abstract class definition that you instantiate into concrete objects, as you do in class-based languages like Java and C++, prototype-based languages like ActionScript 1.0 use an existing object as a model (or prototype) for other objects. While objects in a class-based language may point to a class that serves as its template, objects in a prototype-based language point instead to another object, its prototype, that serves as its template.

AS 2.0
ActionScript 2.0 introduced new keywords such as class, extends, public, and private, that allowed you to define classes in a way that is familiar to anyone who works with class-based languages like Java and C++. It's important to understand that the underlying inheritance mechanism did not change between ActionScript 1.0 and ActionScript 2.0.

AS 3.0
а тут нейкае нешта • насьледваньне сынтаксічна афармляецца праз class/extends •
аб'ект-прататып ёсьць (захавалі legacy), але яго нельга замяніць на іншы (можна мяняць толькі яго самога) •
дадалі нейкі аб'ект Traits (асаблівасьці) каб паскорыць доступ да ўнасьледаваных уласьцівасьцяў •
і ў выніку - два варыянта насьледваньня: праз прататып і праз фіксаваныя ўласьцівасьці (fixed property inheritance) •

actionscript

Previous post Next post
Up