Skip to content

Instantly share code, notes, and snippets.

@darknight1604
Created July 14, 2022 13:00
Show Gist options
  • Save darknight1604/a65c1837bc4b7471ca8c115b8bfba475 to your computer and use it in GitHub Desktop.
Save darknight1604/a65c1837bc4b7471ca8c115b8bfba475 to your computer and use it in GitHub Desktop.
fascinating-dryad-3978

fascinating-dryad-3978

Created with <3 with dartpad.dev.

void main() {
Cloneable computer1 = Computer('Asus');
Cloneable computer2 = computer1.clone();
print(computer1.toString());
print(computer2.toString());
}
abstract class Cloneable {
Cloneable();
Cloneable clone();
}
class Computer extends Cloneable {
final String model;
Computer(this.model) : super();
@override
Cloneable clone() {
return Computer(model);
}
@override
String toString() =>
'hashCode: $hashCode, model: $model, runtimeType: $runtimeType';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment