liveBook · Manning

Sold_out

As explained in Object-Oriented Software Design in C++

A book-specific state class representing a ticket machine with no tickets available.

SOLD_OUT is the ticket machine state used when no tickets remain. The machine enters it after the customer takes the last ticket and has no transitions out of it. section 13.1

Last-ticket transition

After TICKET_SOLD decrements the count to zero, take_ticket() returns the SOLD_OUT state. A later card insertion produces “Game sold out” and “Remove your credit card.”

How Object-Oriented Software Design in C++ covers it

How deep it goes
Defines SOLD_OUT behavior for all four actions and implements it as a State subclass.
Examples
Uses the last-ticket transition and later card insertion, validity checking, ticket taking, and card removal interactions.
What it assumes
Assumes named machine states, card validity, ticket counts, and action-triggered transitions.
What you can do after
Build it from scratch as a State subclass that handles sold-out actions and returns itself for every transition.
How it connects
Connects state transitions, the State Design Pattern, and the TicketMachine object.

This explainer was generated by Manning's knowledge graph from the text of Object-Oriented Software Design in C++. The section links point to the parts of the book it draws on.