Parameter Passing ================= Given the following (partial) class definitions: .. code-block:: c++ :caption: Variant A class Person { public: Person(std::string firstname, std::string lastname); }; .. code-block:: c++ :caption: Variant B class Person { public: Person(const std::string& firstname, const std::string& lastname); }; Question 1: Which One Is Better? -------------------------------- Which of these class definitions would lead to better performance in object initialization? .. list-table:: :align: left :widths: auto :header-rows: 1 * * Variant A * Variant B * * * Question2: Why? --------------- Why does the chosen variant perform better? (Write an ``X`` in the "True" or "False" columns) .. list-table:: :align: left :widths: auto :header-rows: 1 * * True * False * Statement * * * * Variant A has a shorter calling sequence * * * * Variant A is better at moving the parameters into the object * * * * Variant B does not create temporary copies