两种工作模式类似近光灯与远光灯
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
class Observable { | |
void notifyObservers(Object context); | |
void addObserver(Observer observer); | |
void removeObserver(Observer observer); | |
// ... count, | |
} | |
interface Observer { | |
void update(Observable obj, Object context); | |
} |
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
class Car { | |
Engine engine; | |
Brake brake; | |
Window window; | |
start() { | |
engine.start(); | |
} | |
break() { |
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
// 应该可以为接口或是抽象类 | |
interface Component { | |
Object operate(); | |
} | |
class ComponentImpl { | |
Object operate() { } | |
} | |
// 实现接口或是抽象类 |
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
interface TargetInterface { | |
TargetObject operate(); | |
} | |
class LegacyObject { | |
Object method(); | |
} | |
class AdapterForLegacy implements TargetInterface { | |
LegacyObject legacy; |
NB! command-R
is replaced with holding the power button on M1 macs.
a. Boot into recovery using command-R
during reboot, wipe the harddrive using Disk Utility, and select reinstall macOS
b. Initial installation will run for approximately 1 hour, and reboot once