Skip to content

Instantly share code, notes, and snippets.

@kishorekumar080297
Created September 22, 2018 17:48
Show Gist options
  • Save kishorekumar080297/3c5e573371ec608f23a8f520896b369b to your computer and use it in GitHub Desktop.
Save kishorekumar080297/3c5e573371ec608f23a8f520896b369b to your computer and use it in GitHub Desktop.
//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