LLD - Behavioral Design Patterns — Part 1
Find the bug in this Command pattern code snippet:
class Receiver {
void action() { print('Done'); }
}
class Command {
void execute();
}
class ConcreteCommand implements Command {
Receiver receiver;
ConcreteCommand(this.receiver);
void execute() {
receiver.action();
}
}
void main() {
Command c = ConcreteCommand(null);
c.execute();
}