Skip to content

Instantly share code, notes, and snippets.

@LokieVikky
Created February 1, 2023 12:32
Show Gist options
  • Save LokieVikky/5d1694f667388484a0bc8039fd9eb909 to your computer and use it in GitHub Desktop.
Save LokieVikky/5d1694f667388484a0bc8039fd9eb909 to your computer and use it in GitHub Desktop.
void main() {
Bird b = Bird();
b.fly();
Parrot p = Parrot();
p.fly();
p.speak();
// Escaping String
print('Your name is \'Naveen\$\' \\');
String name = 'Parthiban';
print(name.substring(0,6));
// Task learn new 5 methods in string
}
class Bird {
// constructor will be called whenever new object is created for the class
// construtor
Bird();
// namedConstructor
Bird.fromBird(){
}
void fly() {
print("This can fly");
}
}
// Use extends keyword to inherit a class.
class Parrot extends Bird {
void speak() {
print("This can speak");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment