Design Pattern Examples
Overview of object-oriented design patterns
c/Decorator_Exercise.h File Reference

Declaration of the Decorator_Exercise() function as used in the Decorator Pattern. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define __DECORATOR_EXERCISE_H__
 

Functions

void Decorator_Exercise (void)
 Example of using the Decorator Pattern.
 

Detailed Description

Declaration of the Decorator_Exercise() function as used in the Decorator Pattern.

Definition in file c/Decorator_Exercise.h.

Macro Definition Documentation

◆ __DECORATOR_EXERCISE_H__

#define __DECORATOR_EXERCISE_H__

Definition at line 9 of file c/Decorator_Exercise.h.

Function Documentation

◆ Decorator_Exercise()

void Decorator_Exercise ( void  )

Example of using the Decorator Pattern.

The Decorator pattern is used when some data element at run time needs to have its behavior altered. This is supported by providing wrapper functions called decorators that take an instance of the data element and return the data element. Each wrapper function alters the data element and returns it so it can be passed to the next wrapper function.

Definition at line 97 of file Decorator_Exercise.c.

References DynamicString_Clear(), DynamicString_Initialize(), DynamicString_Set(), RedForegroundDecorator(), DynamicString::string, UnderlineDecorator(), and WhiteBackgroundDecorator().