Think about an alert box with three buttons: "try again", "ignore", "cancel", if I need to know which button did user clicked, better to have a param in the DialogButton's constructor, indicates if user clicks this button, a unique predefined value will be returned, and the show() function returns this value then.