Chapter 3
Constructors, Destructors, and Exceptions
In This Chapter
Writing constructors
Using different kinds of constructors
Writing destructors
Understanding the order that takes place in construction and destruction
Throwing and catching exceptions
Now’s the time to seriously master C++. In this chapter, we talk about three vital topics: constructors, destructors, and exceptions. Fully understanding what goes on with constructors and destructors is very important. The better you understand how constructors and destructors work, the less likely you are to write code that doesn’t function the way that you expected and the more likely you are to avoid bugs.
Exceptions are important also in that they let you handle error situations — that is, you can handle problems when they do come up.
Many developers feel that constructors, destructors, and exceptions are extremely simple. In fact, many developers would doubt that these three topics could fill an entire chapter, but they can. ...
Get C++ All-in-One For Dummies, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.