Table of Contents

Class PrintCommand

Example ICommand implementation that prints a message to the console. Undo() logs an acknowledgement that the print was undone.

public class PrintCommand : ICommand
Inheritance
PrintCommand
Implements
Inherited Members

Constructors

PrintCommand(string)

Creates a new PrintCommand with the given message.

public PrintCommand(string message)

Parameters

message string

The text to print when this command is executed.

Methods

Execute()

Performs the command's primary action.

public void Execute()

Undo()

Reverses the command's action, restoring previous state.

public void Undo()