Untitled

 avatar
dzaz
plain_text
8 days ago
412 B
3
Indexable
class Car{
  String brand, color;
  int speed;

  Car(this.brand, this.color, this.speed);

  void BrandCar(){
    print("Mobil merek $brand berwarna $color dengan kecepatan $speed km/jam");
  }
}

void main(){
  Car car1 = Car("Toyota","Putih", 120);
  Car car2 = Car("Avansa","Hitam", 100);
  Car car3 = Car("McLaren","Biru", 204);

  car1.BrandCar();
  car2.BrandCar();
  car3.BrandCar();
}
Leave a Comment