Question: Write aoperator that adds two EvenNumbers. The operator is declared in the class, you need to implement it after the class declaration. Code 1-#include 2

 Write aoperator that adds two EvenNumbers. The operator is declared in

Write aoperator that adds two EvenNumbers. The operator is declared in the class, you need to implement it after the class declaration. Code 1-#include 2 using namespace std; 5 class EvenNumber { 6 public: explicit EvenNumber (int n) value- (n % 2-. 0) ? n : n- 1; //must be even 10 EvenNumber operator+(const EvenNumber& other) const; 12 13 14 15 16 private: 17 18 19 20 //Do not modify anything on or above the line below this 21 /YOUR CODE BELOW int getValue) constf return value; int value; 23 /yoUR CODE 24 25 //YOUR CODE ABOVE 26 //Do not modify anything on or below the line above this 27 28 29 int main() 30 31 32 EvenNumber nl(6) EvenNumber n2(2) 34 35 36 37 38 39 40 41 EvenNumber n3nl +n2; cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!