93
edits
Changes
Command
,→Code Examples
= Code Examples =
== Java C++ == Here is an example of a command pattern used in a text editor (menu bar) // Imaginary example of a command object used with a text editor
class EditorCommandInterface { public: virtual void execute(TextEditor& target) =0; virtual ~EditorCommandInterface() { }}; class CutCommand : public EditorCommandInterface { public: virtual void execute(TextEditor& target) { string s = C++ ==target.GetSelectedText(); target.DeleteRange(target.GetSelectStart(), target.GetSelectEnd()); Clipboard.Copy(s); }};