Simple Example
Presented below is a simple (contrived) example of a C++ hello world program, where the text to be printed and the method of printing it are decomposed using policies.
#includeYou could easily write another OutputPolicy by adding a new class with the member function print and take that as the new OutputPolicy.
Read more about this topic: Policy-based Design
Famous quotes containing the word simple:
“Armies, for the most part, are made up of men drawn from simple and peaceful lives. In time of war they suddenly find themselves living under conditions of violence, requiring new rules of conduct that are in direct contrast to the conditions they lived under as civilians. They learn to accept this to perform their duties as fighting men.”
—Gil Doud, U.S. screenwriter, and Jesse Hibbs. Walter Bedell Smith (Himself)
“From the war of nature, from famine and death, the most exalted object which we are capable of conceiving, namely, the production of the higher animals, directly follows. There is grandeur in this view of life, with its several powers, having been breathed into a few forms or into one; and that, whilst this planet has gone cycling on according to the fixed law of gravity, from so simple a beginning endless forms most beautiful and most wonderful have been, and are being, evolved.”
—Charles Darwin (18091882)