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

what is variations in raman spectra for nanomaterials
Jyoti Reply
I only see partial conversation and what's the question here!
Crow Reply
what about nanotechnology for water purification
RAW Reply
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
yes that's correct
I think
what is the stm
Brian Reply
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
scanning tunneling microscope
how nano science is used for hydrophobicity
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
what is differents between GO and RGO?
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
what is Nano technology ?
Bob Reply
write examples of Nano molecule?
The nanotechnology is as new science, to scale nanometric
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Is there any normative that regulates the use of silver nanoparticles?
Damian Reply
what king of growth are you checking .?
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
Stoney Reply
why we need to study biomolecules, molecular biology in nanotechnology?
Adin Reply
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
what school?
biomolecules are e building blocks of every organics and inorganic materials.
anyone know any internet site where one can find nanotechnology papers?
Damian Reply
sciencedirect big data base
Introduction about quantum dots in nanotechnology
Praveena Reply
what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!

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?