1 Matching Annotations
  1. Apr 2022
    1. By default, C++ will provide a copy constructor and copy assignment operator if one is not explicitly provided. These compiler-provided functions do shallow copies, which may cause problems for classes that allocate dynamic memory. So classes that deal with dynamic memory should override these functions to do deep copies.

      c++ 默认提供什么样的 copy constructor,这会导致什么问题?