callmeFilip / Thinking-in-CPP-Volume-1-2nd-Edition

Homework and Classwork repository
0 stars 0 forks source link

Chapter_14 Task_26 #291

Open callmeFilip opened 3 years ago

callmeFilip commented 3 years ago

Create a class Rock with a default constructor, a copyconstructor, an assignment operator, and a destructor, all of which announce to cout that they’ve been called. In main( ), create a vector (that is, hold Rock objects by value) and add some Rocks. Run the program and explain the output you get. Note whether the destructors are called for the Rock objects in the vector. Now repeat the exercise with a vector<Rock*>. Is it possible to create a vector<Rock&>?