Question #161932

Overload the addition operator to add an 8-bit integer to a boolean.


Expert's answer

class summ {
private:
	int a;
public:
	void operator = (int a1)
	{
		a = a1;
	}
    int operator + (bool a2)
    {
      	if (a2)
    	{
    		return a + 1;
    	}
    	else {
    		return a;
    	}
    }
};

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS