While trying to solve Box-It challenge on Hackerrank I got stuck at overloading the operators <
,<<
This is the Box struct
struct Box
{
public:
int l,b,h;
int getLength(void);
int getBreadth(void);
int getHeight(void);
long long CalculateVolume(void) ;
Box operator<<(const Box& b) {
Box box;
box.l = this->l + b.l;
box.b = this->b + b.b;
box.h = this->h + b.h;
return box;
}
};
int Box::getLength(void)
{
return l;
}
int Box::getBreadth(void)
{
return b;
}
int Box::getHeight()
{
return h;
}
long long Box::CalculateVolume(void)
{
return l*h*b;
}
Error log can be found on pastebin