Introduction

10May - by qkim0x01 - 0 - In /Effective_C++

Effective C++ by Scott Meyers book review

Introduction
  • Copy Constructor
    • Used to initialize an object with a different object of the same type
    • Defines how an object is passed by value
  • Copy assignment operator
    • Used to copy the value from one object to another of the same type
 

  • The parameter w is passed by value, so aWidget is copied into w.
    • The copying is done by copy constructor.
    • Pass-by-value == “call the copy constructor”
      • But Pass-by-reference-to-const is typically a better choice
 

Leave a Reply

Your email address will not be published. Required fields are marked *