Created
April 19, 2016 16:40
-
-
Save AbraaoAlves/82b37799cdaab0a0df868ab16caea5b7 to your computer and use it in GitHub Desktop.
dart code sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:math' as Math; | |
| class Circulo { | |
| int ri; | |
| Circulo(int r){ | |
| this.ri = r; | |
| } | |
| calcularArea(int r){ | |
| return Math.PI * Math.pow(r, 2); | |
| } | |
| } | |
| class CoroaCircular extends Circulo{ | |
| int re; | |
| CoroaCircular(int r, int re): super(r) { | |
| this.re = re; | |
| } | |
| calculaAreaDaCoroa(){ | |
| return this.calcularArea(this.re) - this.calcularArea(this.ri); | |
| } | |
| } | |
| void main() { | |
| var x1 = 10; | |
| var x2 = 20; | |
| var cc = new CoroaCircular(x1, x2); | |
| print("area = " + cc.calculaAreaDaCoroa().toString()); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment