Created
September 22, 2018 17:48
-
-
Save kishorekumar080297/3c5e573371ec608f23a8f520896b369b to your computer and use it in GitHub Desktop.
This file contains 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
//Create by Kishore Kumar G on 22/09/2018 (https://github.com/kishorekumar080297) | |
void main() { | |
//superman is an object of class Hero | |
var superman = new Hero('Clark'); | |
superman.flyPower(); | |
//spiderman is an object of class Hero | |
var spiderman = new Hero('Peter'); | |
spiderman.webPower(); | |
} | |
class Hero { | |
String name; | |
//constructor | |
Hero(this.name); | |
//method-1 | |
flyPower() { | |
print('Superhero ${name} can fly.'); | |
} | |
//method-2 | |
webPower() { | |
print('Superhero ${name} can cling tenaciously using spider web.'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment