Commit 307a647f53e99e512022158541d3bb382472bb6f
1 parent
bc4d0f58
Updated Koenig lookup example
Showing
2 changed files
with
25 additions
and
1 deletions
examples06/01-operator/koenig.cpp
0 → 100644
| 1 | +#include <iostream> | |
| 2 | +#include <string> | |
| 3 | + | |
| 4 | +namespace Chrono { | |
| 5 | +class Date { /* ... */ | |
| 6 | +}; | |
| 7 | +bool operator==(const Date &, const std::string &); | |
| 8 | +std::string format(const Date &); // make string representation | |
| 9 | +// ... | |
| 10 | +} // namespace Chrono | |
| 11 | + | |
| 12 | + | |
| 13 | +void f(Chrono::Date d, std::string s) { | |
| 14 | + if (d == s) { | |
| 15 | + // ... | |
| 16 | + } else if (d == "August 4, 1914") { | |
| 17 | + // ... | |
| 18 | + } | |
| 19 | +} | ... | ... |
examples06/01-operator/makefile