Right. What material are you using to learn C++?
C++ Programming from problem analysis to program design 5th edition by D.S. Malik
Eh, that book introduces std::vector in chapter 10, and pointers in chapter 14. Maybe you need to go through the material more carefully, without skipping chapters. To get this right, you need to be familiar with the idea that user defined classes such as std::vector<int> can behave like built-in types like int, e.g., they can be copied. Then you need to be familiar with defining classes, including implementing the copy constructor, copy assignment operator and destructor.Originally Posted by chickenlittle