Advertisement
193030

04. Compiler generated functions

Jul 8th, 2021
930
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <iostream>
  2. // If the compiler generated functions are not used, they are not generated
  3. using namespace std;
  4.  
  5. class dog {};
  6.  
  7. // is equivalent to
  8.  
  9. class dog
  10. {
  11. public:
  12.     dog(const dog& rhs) { } // copy constructor
  13.  
  14.     dog& operator= (const dog& rhs) { }; // member by member copying
  15.  
  16.     dog() { }; // 1. Call base class's default constructor
  17.                // 2. Call data member's default constructor
  18.     ~dog() { }; // 1. Call base class's default destructor
  19.                // 2. Call data member's default destructor
  20. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement