Answer to Question #315362 in C++ for Helal

Question #315362

Write a program to find sum and average of three values using override method and overload method.

1
Expert's answer
2022-03-21T14:08:48-0400
class Sum 
{
public:
    Sum(int _value)
    {
        this->value = _value;
      
    }
    Sum operator+(Sum b)
    {
        return Sum(this->value + b.value);
    }
    Sum operator+(Sum c)
    {
        return Sum(this->value2 + c.value2);
    }
    Sum operator+(Sum a)
    {
        return Sum(this->value3 + a.value3);
    }
    int Average(int value ,  int value2 , int value3)
    {
        return value + value2 + value3 / 3;
    }
private:
    int value = 1;
    int value2 = 1;
    int value3 = 1;
};

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