Answer to Question #161932 in C++ for Skiper

Question #161932

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


1
Expert's answer
2021-02-07T16:49:05-0500
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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog