C++ features by examples
Decorator Struct Reference

is a partial wrapper of an object with same as wrapped object Interface More...

Inheritance diagram for Decorator:
Collaboration diagram for Decorator:

Public Member Functions

 Decorator (Interface &o)
 
int method () override
 
- Public Member Functions inherited from Interface
virtual int method ()=0
 
virtual ~Interface ()=default
 

Public Attributes

Interfacesubject
 

Detailed Description

is a partial wrapper of an object with same as wrapped object Interface

Definition at line 340 of file patterns.cpp.

Constructor & Destructor Documentation

◆ Decorator()

Decorator::Decorator ( Interface o)
inline

Definition at line 344 of file patterns.cpp.

344: subject(o) {}
Interface & subject
Definition: patterns.cpp:348

Member Function Documentation

◆ method()

int Decorator::method ( )
inlineoverridevirtual

Implements Interface.

Definition at line 345 of file patterns.cpp.

345 {
346 return 100 + this->subject.method();
347 }
virtual int method()=0
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ subject

Interface& Decorator::subject

Definition at line 348 of file patterns.cpp.


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