For example, if you have a class called Point,
const Point Point::operator+(const Point& a) Wow const Point Point::operator+(Point a) What's the difference between
I only know that const Point& is faster because it is not a call by value, but a call by reference. Can anyone explain it in detail?
c++ const reference
In the above case, const Point&a
means that you cannot change the reference target of a
.
© 2024 OneMinuteCode. All rights reserved.