Chapter     12

Copying and Assigning Data to Objects

You have seen how we can pass data into functions by value, by reference, or by pointer. If you choose to pass a class object into a function by value, C++ will make a copy of the class. This copy operation happens automatically or implicitly. This chapter is going to show you some of these implicit operations that can occur when using classes in your programs and the ways in which you can alter and manage these implicit operations.

Copy Constructors

Classes in C++ can use constructors and destructors to initialize and clean up the objects that you use in your programs. C++ also allows you to specify a copy constructor that is called when an object is being copied into a new instance of an ...

Get Learn C++ for Game Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.