C++ features by examples
|
Classes | |
struct | Component |
accepts a pure virtual Visitor More... | |
struct | Visitor |
is a pure virtual visitor of Sample_component and other specific components More... | |
struct | Sample_component |
one of many components is independed from Sample_visitor and implemenation of function visit. More... | |
Functions | |
string | client_visit (const forward_list< unique_ptr< Component > > &components, const forward_list< unique_ptr< Visitor > > &visitors) |
knows only virtual visitor and component More... | |
void | visitor_demo () |
https://refactoring.guru/design-patterns/visitor/cpp/example
string client_visit | ( | const forward_list< unique_ptr< Component > > & | components, |
const forward_list< unique_ptr< Visitor > > & | visitors | ||
) |
knows only virtual visitor and component
Definition at line 469 of file patterns.cpp.
void visitor_demo | ( | ) |
Call hierarchy:
visitor_demo client_visit component_accept visit component_method
is one of many specific visitors with custom method visit Per each of the possible pairs of Sample_visitor and Sample_component
overloaded function for each component
Definition at line 491 of file patterns.cpp.