This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class PlanetVisitor { | |
void visit({Planet planet}); | |
} | |
abstract class Planet { | |
void accept({PlanetVisitor visitor}); | |
} | |
class MoonJedah extends Planet { | |
@override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class PrintStrategy { | |
String print(String string); | |
} | |
class Printer { | |
PrintStrategy _strategy; | |
Printer({PrintStrategy strategy}) : _strategy = strategy; | |
String print(String string) { | |
return _strategy.print(string); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class State { | |
bool isAuthorized({Context context}); | |
String userId({Context context}); | |
} | |
class Context { | |
State _state = new UnauthorizedState(); | |
bool get isAuthorized => _state.isAuthorized(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class Currency { | |
String sysmbol(); | |
String code(); | |
} | |
class Euro extends Currency { | |
@override | |
String sysmbol() { | |
return "€"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class Switch { | |
Appliance appliance; | |
void turnOn(); | |
} | |
abstract class Appliance { | |
void run(); | |
} | |
class RemoteControl extends Switch { |