Skip to content

Instantly share code, notes, and snippets.

@yusufpats
Last active March 29, 2023 03:11
Show Gist options
  • Save yusufpats/6cc1016f41c4019bd4847c4c465fcae6 to your computer and use it in GitHub Desktop.
Save yusufpats/6cc1016f41c4019bd4847c4c465fcae6 to your computer and use it in GitHub Desktop.
enchanted-illusion-7138

Concept of classes, objects, inheritance

enchanted-illusion-7138

Created with <3 with dartpad.dev.

class Animal {
void sound(){
print("I will play a sound");
}
}
class Cat extends Animal {
@override
void sound(){
super.sound();
print("Meow");
}
void walk(){
}
}
class Fish extends Animal {
@override
void sound(){
print("Dont know");
}
void swim(){
}
}
void main() {
Cat tiger = new Cat();
tiger.sound();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment