<< Chapter < Page Chapter >> Page >

This interface declares the method named volume . Because this interface is extended by the interface named IArea , any class that implements IArea inherits the abstract method named volume and must provide a concrete definition for the method.

The file named ICircumference.as

The interface named ICircumference is very similar to the interface named IVolume . The code for this interface is provided in Listing 14 near the end of the lesson.

This interface declares the method named circumference . Once again, because this interface is extended by the interface named IArea , any class that implements IArea inherits the abstract method named circumference and must provide a concrete definition for the method.

The file named MyCircle.as

The class named MyCircle is shown in its entirety in Listing 9

The class named mycircle.

package CustomClasses{ public class MyCircle implements IArea{private var radius:Number;public function MyCircle(radius:Number){//constructor this.radius = radius;}//end constructorpublic function area():String{ return "Radius = " + radius + "\n" +"Area = " + Math.PI * radius * radius; }//end areapublic function id():String{return "Circle\n"; }//end idpublic function circumference():String{return "Radius = " + radius + "\n" + "Circumference = " + 2 * Math.PI * radius;}//end function circumferencepublic function volume():String{ //Assumes that the shape is a cylinder with a// depth of ten units. return "Radius = " + radius + "\n" +"Depth = 10\n" + "Volume = " + 10 * Math.PI * radius * radius;}//end area}//end class }//end package

Inherits four abstract methods

As you can see, this class implements the interface named IArea , causing it to inherit the following abstract methods :

  • area
  • id
  • circumference
  • volume

The area and id methods are declared in the IArea interface and are inherited directly into the MyCircle class.

The circumference and volume methods are declared in the interfaces named ICircumference and IVolume , both of which are extended by the IArea interface. Therefore, the MyCircle class inherits those abstract methods by way the IArea interface.

Concrete definitions for four methods

Listing 9 provides concrete versions of the four inherited abstract methods. As a practical matter, this amounts to overriding inherited abstract methods.Note however, that unlike the case of overriding a concrete method inherited from a class, the keyword override is not required when overriding an abstract method inherited from an interface.

Other than the fact that this class implements an interface and overrides inherited abstract methods, there is nothing in Listing 9 that should be new toyou.

The file named MyRectangle.as

The class named MyRectangle is defined in Listing 16 near the end of the lesson. This class is very similar to the MyCircle class shown in Listing 9. As with the MyCircle class, it implements the IArea interface. Therefore, it inherits and overrides the same four abstract methods shown in the above list .

Run the program

I encourage you to run this program from the web. Then copy the code from Listing 10 through Listing 16. Use thatcode to create a Flex project. Compile and run the project. Experiment with the code, making changes, and observing the results of your changes. Make certain that you can explain why your changes behave as theydo.

Questions & Answers

Examine the distinction between theory of comparative cost Advantage and theory of factor proportion
Fatima Reply
What is inflation
Bright Reply
a general and ongoing rise in the level of prices in an economy
AI-Robot
What are the factors that affect demand for a commodity
Florence Reply
price
Kenu
differentiate between demand and supply giving examples
Lambiv Reply
differentiated between demand and supply using examples
Lambiv
what is labour ?
Lambiv
how will I do?
Venny Reply
how is the graph works?I don't fully understand
Rezat Reply
information
Eliyee
devaluation
Eliyee
t
WARKISA
hi guys good evening to all
Lambiv
multiple choice question
Aster Reply
appreciation
Eliyee
explain perfect market
Lindiwe Reply
In economics, a perfect market refers to a theoretical construct where all participants have perfect information, goods are homogenous, there are no barriers to entry or exit, and prices are determined solely by supply and demand. It's an idealized model used for analysis,
Ezea
What is ceteris paribus?
Shukri Reply
other things being equal
AI-Robot
When MP₁ becomes negative, TP start to decline. Extuples Suppose that the short-run production function of certain cut-flower firm is given by: Q=4KL-0.6K2 - 0.112 • Where is quantity of cut flower produced, I is labour input and K is fixed capital input (K-5). Determine the average product of lab
Kelo
Extuples Suppose that the short-run production function of certain cut-flower firm is given by: Q=4KL-0.6K2 - 0.112 • Where is quantity of cut flower produced, I is labour input and K is fixed capital input (K-5). Determine the average product of labour (APL) and marginal product of labour (MPL)
Kelo
yes,thank you
Shukri
Can I ask you other question?
Shukri
what is monopoly mean?
Habtamu Reply
What is different between quantity demand and demand?
Shukri Reply
Quantity demanded refers to the specific amount of a good or service that consumers are willing and able to purchase at a give price and within a specific time period. Demand, on the other hand, is a broader concept that encompasses the entire relationship between price and quantity demanded
Ezea
ok
Shukri
how do you save a country economic situation when it's falling apart
Lilia Reply
what is the difference between economic growth and development
Fiker Reply
Economic growth as an increase in the production and consumption of goods and services within an economy.but Economic development as a broader concept that encompasses not only economic growth but also social & human well being.
Shukri
production function means
Jabir
What do you think is more important to focus on when considering inequality ?
Abdisa Reply
any question about economics?
Awais Reply
sir...I just want to ask one question... Define the term contract curve? if you are free please help me to find this answer 🙏
Asui
it is a curve that we get after connecting the pareto optimal combinations of two consumers after their mutually beneficial trade offs
Awais
thank you so much 👍 sir
Asui
In economics, the contract curve refers to the set of points in an Edgeworth box diagram where both parties involved in a trade cannot be made better off without making one of them worse off. It represents the Pareto efficient allocations of goods between two individuals or entities, where neither p
Cornelius
In economics, the contract curve refers to the set of points in an Edgeworth box diagram where both parties involved in a trade cannot be made better off without making one of them worse off. It represents the Pareto efficient allocations of goods between two individuals or entities,
Cornelius
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Object-oriented programming (oop) with actionscript. OpenStax CNX. Jun 04, 2010 Download for free at http://cnx.org/content/col11202/1.19
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Object-oriented programming (oop) with actionscript' conversation and receive update notifications?

Ask