From b7297e6503f139d8afa4aff35b77519e4134f8db Mon Sep 17 00:00:00 2001 From: mohamed-arafa <58062859+mohamed-arafa@users.noreply.github.com> Date: Thu, 28 Nov 2024 19:13:30 +0200 Subject: [PATCH] Update 05_homework_03_answer.cpp Added 2 more advantages of const A& over A& --- 19-object-oriented-programming/05_homework_03_answer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/19-object-oriented-programming/05_homework_03_answer.cpp b/19-object-oriented-programming/05_homework_03_answer.cpp index 9d5fe5f..daa74fd 100644 --- a/19-object-oriented-programming/05_homework_03_answer.cpp +++ b/19-object-oriented-programming/05_homework_03_answer.cpp @@ -44,6 +44,8 @@ class D { D(const A &a, const B &b, const C &c) : aa(a), bb(b), cc(c){ // By using & => we use same memory object hence faster and low memory // By using const => we remember developers you shouldn't try to change this parameter + // also this allow the user to pass temperory objects and const objects. + // this allows to receive Rvalue and Lvalue not just Lvalue } };