blob: 906d4f8f1abdf3076ee3131ff35814a3f07fb4f8 [file] [log] [blame]
import 'dart:math' as math;
class Circle implements Shape {
Circle(this.radius);
double calculateArea() => math.pi * radius * radius;
final double radius;
}
class Square implements Shape {
Square(this.length);
double calculateArea() => length * length;
final double length;
}
double calculateArea(Shape shape) => switch (shape) {
Square(length: var l) => l * l,
Circle(radius: var r) => math.pi * r * r
};
expect(expected, actual) {}
main() {}
sealed class Shape {
double calculateArea();
}