Design Pattern Examples
Overview of object-oriented design patterns
IObserverNumberChanged Struct Referenceabstract

Represents an observer to the Subject class. An observer implements this interface and then subscribes to the Subject with the interface. The observer will be called whenever a change in the number is made. More...

#include <ObserverSubject_NumberProducer.h>

Inheritance diagram for IObserverNumberChanged:
Inheritance graph
Collaboration diagram for IObserverNumberChanged:
Collaboration graph

Public Types

using shared_ptr_t = std::shared_ptr< IObserverNumberChanged >
 Alias to make it easier to use this shared pointer.
 

Public Member Functions

virtual ~IObserverNumberChanged ()
 Virtual destructor required for interfaces in abstract classes.
 
virtual void NumberChanged ()=0
 This is called whenever the number in the ObserverSubject_NumberProducer object is changed.
 

Detailed Description

Represents an observer to the Subject class. An observer implements this interface and then subscribes to the Subject with the interface. The observer will be called whenever a change in the number is made.

This interface is specific to the ObserverSubject_NumberProducer example, which is a typical requirement for a Subject that supports observers.

Definition at line 41 of file ObserverSubject_NumberProducer.h.

Member Typedef Documentation

◆ shared_ptr_t

using shared_ptr_t = std::shared_ptr<IObserverNumberChanged>

Alias to make it easier to use this shared pointer.

Definition at line 46 of file ObserverSubject_NumberProducer.h.

Constructor & Destructor Documentation

◆ ~IObserverNumberChanged()

virtual ~IObserverNumberChanged ( )
inlinevirtual

Virtual destructor required for interfaces in abstract classes.

Definition at line 51 of file ObserverSubject_NumberProducer.h.

Member Function Documentation

◆ NumberChanged()

virtual void NumberChanged ( )
pure virtual

This is called whenever the number in the ObserverSubject_NumberProducer object is changed.

Implemented in ObserverForDecimal, ObserverForHexaDecimal, and ObserverForBinary.


The documentation for this struct was generated from the following file: