01-edu / Branch-Mobile

🎯 Repository for the Mobile branch Dart tests.
1 stars 1 forks source link

Week1/day1/ex10 - Circle #5

Closed jotapero closed 2 years ago

jotapero commented 2 years ago

Note 1

Provided code does not run, is it on purpose?

class Rectangle {
  double left, top, width, height;

  Rectangle(this.left, this.top, this.width, this.height);

  double get right => this.left + this.width;

  set left(double value) {
    if (value >= 0) {
      this.left = value;
    } else {
      throw new FormatException(); 
    }
  }

  double get bottom => this.top - this.height;

}

void main() {
  var rect = Rectangle(3, 4, 20, 15);
  rect.left = 12;
}
sakenism commented 2 years ago

you are right, it is being fixed