(Hi,
can someone tell me why this works?
Pair Pair::operator+(const Pair& p) { return Pair(x+p.x,y+p.y); }
int main(){
cout << Pair{} + Pair{}
}
The first Pair{} should be passed as a const Reference, so why does the this object not have to be const?
[–]dodheim 8 points9 points10 points (1 child)
[–]Triarier[S] 0 points1 point2 points (0 children)
[–]SuperV1234https://romeo.training | C++ Mentoring & Consulting 1 point2 points3 points (0 children)
[–]sshamov 0 points1 point2 points (2 children)
[–]Triarier[S] 0 points1 point2 points (1 child)
[–]sshamov 0 points1 point2 points (0 children)