liveBook · Manning

Subject

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

A book-specific C++ superclass that maintains observers and notifies them when published content changes.

Subject is a C++ superclass for the publisher in the Observer Design Pattern. It stores subscribed Observer objects and notifies them when published content changes. section 12.1.3

Baseball reporter

BaseballReporter inherits from Subject. After producing an Event, it calls notify(); LogReport, GraphReport, TableReport, and FanClubReport respond independently. A fan-club report can detach itself after receiving its selected player’s event.

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

How deep it goes
Defines attach, detach, and notify with a vector and polymorphic updates, while deferring broader memory-management concerns.
Examples
Uses BaseballReporter, Event objects, report observers, attach(), detach(), notify(), and update().
What it assumes
Assumes basic C++ classes, inheritance, virtual functions, pointers, and vectors.
What you can do after
Apply it via C++ to add or remove subscribers without changing publisher code.
How it connects
Connects the Observer Design Pattern with inheritance, polymorphism, and the publisher–subscriber model.

Related concepts

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.