InterviewSolution
| 1. | 
                                    Write the coding for the following output using constructor overloading.Output:Constructor without parameters.Parameterized constructor… Copy Constructor… Enter data… 20 30 Object a: The numbers are..20 30 The sum of the numbers are.. 50 Object b : The numbers are..10 20 The sum of the numbers are.. 30Object c.. The numbers are..10 20 The sum of the numbers are.. 30 | 
                            
| 
                                   
Answer»  #include using namespace std; class add { int num1, num2, sum; public: add() { cout << “\n Constructor without parameters…”; num1 = 0; num2 = 0; sum = 0; } add (int s1, int s2 ) { cout << “\n Parameterized constructor…”; num1= s1; num2=s2; sum=0; } add (add &a) { cout << “\n Copy Constructor…”; ‘ num1 = a.num1; num2 = a.num2; sum = 0; } void getdata() { cout<<“\n Enter data …”; cin>>num 1 >> num2; } void addition() { sum=num 1 + num2; } void putdata() { cout << “\n The numbers are..”; cout <cout << “\n The sum of the numbers are..” << sum; } }; int main() { add a, b (10, 20), c(b); a. getdata(); a. addition(); b. addition(); c. addition(); cout << “\n Object a : “; a. putdata(); cout << “\n Object b : “; b. putdata(); cout << “\n Object c..”; c. putdata(); return 0; }  | 
                            |