C++ features by examples

Structural patterns More...

Collaboration diagram for Structural:

Classes

struct  Standalone
 is wrapped by Bridge. AKA adaptee of Adapter More...
 
struct  Bridge
 is a wrapper using different from Standalone interface. AKA Adapter More...
 
struct  Proxy
 is a opaque wrapper with same as wrapped object Interface More...
 
struct  Decorator
 is a partial wrapper of an object with same as wrapped object Interface More...
 
struct  Composite
 

Functions

void structural_patterns_demo ()
 

Detailed Description

Structural patterns

https://refactoring.guru/design-patterns/structural-patterns

Function Documentation

◆ structural_patterns_demo()

void structural_patterns_demo ( )

Definition at line 362 of file patterns.cpp.

363{
364 Standalone sa;
365 Bridge br(sa);
366 br.method();
367 Proxy p(br);
368 Decorator dec(br);
369 dec.method();
370 dec.subject.method();
371 p.method();
372 Composite comp;
373 comp.children.push_front(p);
374 comp.method();
375}
is a wrapper using different from Standalone interface. AKA Adapter
Definition: patterns.cpp:317
int method() override
Definition: patterns.cpp:354
forward_list< reference_wrapper< Interface > > children
Definition: patterns.cpp:359
is a partial wrapper of an object with same as wrapped object Interface
Definition: patterns.cpp:343
is a opaque wrapper with same as wrapped object Interface
Definition: patterns.cpp:331
is wrapped by Bridge. AKA adaptee of Adapter
Definition: patterns.cpp:308
Here is the call graph for this function:
Here is the caller graph for this function: