Copy constructor for object with vector fo object as member variable
问题 I have a class A with a vector<Object> object_list_ as a member variable. I know that if I had a vector of pointers I would have needed to write a specific copy constructor to achieve a deep copy. However, in this case, as I don't have pointers, when copying an object of type A , the default copy constructor will automatically also call the copy constructors of Object or each element in object_list_ or do I have to write my own copy constructor to do that? 回答1: The default copy constructor