We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This is a bad practice: ostream& operator<<(ostream& out, Box B)
The second parameter should be const Box& B. Otherwise, you are invoking the copy constructor in a place where it is not necessary.
This is the reason some people get 4 instead of 7 for the sample test case.
Also, all those getXX() functions are missing the const qualifier at the end.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Box It!
You are viewing a single comment's thread. Return to all comments →
This is a bad practice: ostream& operator<<(ostream& out, Box B) The second parameter should be const Box& B. Otherwise, you are invoking the copy constructor in a place where it is not necessary.
This is the reason some people get 4 instead of 7 for the sample test case.
Also, all those getXX() functions are missing the const qualifier at the end.