Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 150

Programming actionscript 3.0
Table of Contents

Advertisement

The classes and interfaces that define the geometric shapes in this example are shown in the
following diagram using Unified Modeling Language (UML) notation:
GeometricShapes Example Classes
<< interface>>
IGeometricShape
+getArea (): Number
+describe(): String
Circle
+diameter : Number
+Circle (): Circle
+getArea (): Number
+describe(): String
+getCircumference (): Number
Defining common behavior with interfaces
This GeometricShapes application deals with three types of shapes: circles, squares, and
equilateral triangles. The GeometricShapes class structure begins with a very simple interface,
IGeometricShape, that lists methods common to all three types of shapes:
package com.example.programmingas3.geometricshapes
{
public interface IGeometricShape
{
function getArea():Number;
function describe():String;
150
Object-Oriented Programming in ActionScript
EquilateralTriangle
+EquilateralTriangle ():EquilateralTriangle
+getArea (): Number
+describe(): String
<< interface>>
IPolygon
+getPerimeter (): Number
+getSumOfAngles (): Number
RegularPolygon
+numSides : int
+sideLength : Number
+RegularPolygon ():RegularPolygon
+getSumOfAngles (): Number
+getPerimeter (): Number
+getArea (): Number
+describe(): String
+Square ():Square
+getArea ():Number
+describe():String
Square

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents