forked from faranakR/full-cpp-tutorial-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchapter_32_design_patterns.cpp
More file actions
53 lines (44 loc) · 1.64 KB
/
chapter_32_design_patterns.cpp
File metadata and controls
53 lines (44 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*=============================================================================
* CHAPTER 32: DESIGN PATTERNS
* =============================================================================
*
* C++ Development Course - Consolidated Examples
* Original Author: Faranak Rajabi
*
* This file contains 1 code example(s) from Chapter 32.
*
* USAGE:
* - Review each example section
* - Uncomment the code you want to test
* - Compile: g++ -std=c++17 -Wall thisfile.cpp -o program
* - Run: ./program
*
* NOTE:
* Some examples are code snippets designed to illustrate specific
* concepts and may need additional context to compile.
*
=============================================================================*/
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
// ============================================================================
// EXAMPLE 1: Using static reference
// ============================================================================
int main () {
// Using static reference
getStaticInt () = 100; // Can assign to function call !
std :: cout << getStaticInt () << ’\ n ’; // 100
// Using max
int x {5} , y {10};
max (x , y ) = 20; // Modifies y ( the larger value )
std :: cout << " x = " << x << " , y = " << y << ’\ n ’;
// ============================================================================
// MAIN FUNCTION
// ============================================================================
// Uncomment the examples above and add your test code here
int main() {
std::cout << "Chapter 32: Design Patterns" << std::endl;
// Your test code here
return 0;
}