July 12, 2020 ( last updated : July 12, 2020 )
Dart
Flutter
Web
App
Hybrid
https://github.com/sneakstarberry/
다트 클래스
class Person {
String name;
}
person.name
’.’을 통해 member에 접근할 수 있습니다.
class Person{
String name;
Person(name) {
this.name = name;
}
}
class Person{
String name;
Person(this.name);
}
main(){
Person person = Person('sneakstarberry');
print(person.name); // sneakstarberry
}
class Vehicle{
Vehicle(this.color);
final String color;
final String definition = 'Vehicle';
}
class Car extends Vehicle {
Car(String color) : super(color);
}
class Hatch extends Car {
Hatch(String color);
}
main(){
final hatch = Hatch('red');
print('Result: ${hatch is Vehicle}');
}
class Vehicle{
Vehicle(this.color);
final String color;
final String definition = 'Vehicle';
}
class Car implements Vehicle {
Car(this.carColor);
final String carColor;
@override
String get color => carColor;
@override
String get definition => '$carColor car';
}
main(){
final car = Car('red');
print('Result: ${car is Vehicle}');
}
class Animal {}
// behaviors
class Flyer {
void fly() => print('I can fly!');
}
abstract class Swimmer {
void swim() => print('I can swim!');
}
class Bird extends Animal with Flyer {}
class Duck extends Animal with Swimmer, Flyer {}
main(){
final bird = Bird();
print(bird is Flyer);
}
감사합니다.
Originally published July 12, 2020
Latest update July 12, 2020
Related posts :