-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProxy.cpp
38 lines (35 loc) · 985 Bytes
/
Proxy.cpp
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
/**
* \file Proxy.cpp
* \brief
*
* \review
*
* Proxy allows one object to stand for something else.
* So whilst you think you are dealing with one object,
* you are actually dealing with something else.
* In this example, CoutProxy stands for std::cout.
*/
#include <StdStream/StdStream.h>
#include <StdTest/StdTest.h>
#include <Stl.h>
//--------------------------------------------------------------------------------------------------
class ProxyCout
{
public:
void write(const std::string &str) const
{
std::cout << str;
}
};
//--------------------------------------------------------------------------------------------------
void hello_world(const ProxyCout &a_cout)
{
a_cout.write("Hello world!\n");
}
//--------------------------------------------------------------------------------------------------
int main()
{
hello_world( ProxyCout() );
return 0;
}
//--------------------------------------------------------------------------------------------------