xxxxxxxxxx
abstract class InterfaceClass {
String? foo;
void testFunction();
}
class BaseClass extends InterfaceClass {
@override
void testFunction() {
// TODO: implement testFunction
foo = 'bar';
}
}
xxxxxxxxxx
class SomeClass {
final int value;
Better(this.value);
@override
bool operator ==(Object other) =>
other is Better &&
other.runtimeType == runtimeType &&
other.value == value;
@override
int get hashCode => value.hashCode;
}
xxxxxxxxxx
void main() {
Point point1 = Point(1, 1);
Point2 point2 = Point2(10, 10);
print(point2);
print("toString has been override");
print(point1);
}
class Point {
double x, y;
Point(this.x, this.y);
@override
String toString() {
return "$x : $y";
}
}
class Point2 {
double x, y;
Point2(this.x, this.y);
}