Skip to content

Instantly share code, notes, and snippets.

@onumanfj
Created June 19, 2023 20:32
Show Gist options
  • Save onumanfj/32172191136ae9b9abc0c64a714680f4 to your computer and use it in GitHub Desktop.
Save onumanfj/32172191136ae9b9abc0c64a714680f4 to your computer and use it in GitHub Desktop.
dart - classes and objects

dart - classes and objects

Created with <3 with dartpad.dev.

void main() {
//objects
Human yaw = Human(5.9);
print(yaw.height);
// Humaniod francios = Humaniod();
// print(francios.height);
// francios.height = 5.9;
// print(francios.height);
// francios.talk('Hello world!');
}
class Human {
//constructors
Human(double startingHeight) {
height = startingHeight;
}
//properties
late double height;
int age = 18;
//methods
void talk(String whatToSay) {
print(whatToSay);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment