Summary
This chapter covers many important aspects of defining and using classes. Several of these aspects are subtle, even difficult, concepts. If some of them seem obscure or unusually complex to you, don't feel bad—they affect most newcomers to C++ that way. Often, the way you come to really appreciate concepts like copy constructors is through getting into trouble by ignoring them. So some of the material in this chapter may seem vague to you until your own experiences enrich your understanding. Meanwhile, let's summarize the chapter.
You can use new in a class constructor to allocate memory for data and then assign the address of the memory to a class member. This enables a class, for example, to handle strings of various sizes without committing ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access