Created
February 1, 2023 12:32
-
-
Save LokieVikky/5d1694f667388484a0bc8039fd9eb909 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
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