This source code is from Thinking in C++, 2nd Edition, Volume 2, by Bruce Eckel & Chuck Allison.

You can use Borland, G++ (For version 3 and above only), Microsoft (For C++ with .NET only) to compile and build this source code.

Writing perfect software may be a daunting task for developers, but a few defensive programming techniques which are routinely applied can go a long way toward narrowing the gap between code and ideal. Defensive programming practices are often used where high availability of the application is required, safety if utmost concern, or security is needed for application to work.

Nothing will give you more peace of mind than thoroughly tested code. If it’s been a hassle for you in the past, use an automated framework, such as the one we’ve presented here, to integrate routine testing into your daily work. You (and your users!) will be glad you did.

  Defensive Programming Techniques (14.0 KiB, 10,432 hits)

If you are interested to learn more about Defensive Programming Techniques then Thinking in C++, 2nd Edition, Volume 2 book should be your best choice.

Thinking in C++, 2nd Edition, Volume 2

The Thinking in C++ series serves as an outstanding primer for practical C++ programming or as preparation for more advanced studies. A must have for any C++ Developer that explains every Object Oriented Programming concept using C++ with practical examples.