This is a C++ project that describe the usage of Strategy Pattern design
The aim is to implement one task which is in the page 25 of <Head First> ( Chinese version ).
creatd by Knight 2010.07.15
www.liaoqiqi.com/blog

This is a C++ project that describe the usage of Strategy Pattern design
The aim is to implement one task which is in the page 25 of <Head First> ( Chinese version ).
creatd by Knight 2010.07.15
www.liaoqiqi.com/blog

This is a C++ project that describe the usage of Builder Pattern design and Decorator Pattern design.
The aim is to implement one task which is in the page 614 of <Head First> ( Chinese version ).
File List:
There are several important tips:
1. Java have memory garbage, but C++ don't have. So you should be careful when you use Decorator Pattern design.
The trick is that you should write destructor for every decorator class. ( ex, VocationHotel, VocationTicket )
creatd by Knight 2010.07.14
www.liaoqiqi.com/blog
I wrote a single pattern with C++ implementation[1] article the day before yesterday. However, this version has one fatal problem: it has Memory Leak error! This is because you use "new" to malloc memory explicitly, but you never delete it manually. Although OS will help you free this heap, you program reallly exist memory leak problem.
It's well known that Java has garbage collector, so he never thinks of freeing the memory. But we are C++ programmers, we should free heap memory if we new/malloc them.
Ok, Now I'll introduce my C++ single pattern correct version:
继续阅读
There is a pretty good article about how to construct a singleton design patter project in C++[1]. You can learn several methods for this pattern desgin.
It' s very useful and I strongly recommmend you to use one of them.
Example of a C++ Singleton class: