Bismillahir Rahmanir Rahim
The program that uses the following properties - class name- objarg, two integer type private member variable- a, b. Three public member function - input_add_val(int c, int d), alter_sign(objarg x), show(). input_add_val(int c, int d) get the value from main() and do the addition operation for a and b. show() function will displays the addition result as output. alter_sign(objarg x) change the sign of addition result.
Solution:
#include<iostream.h> class objarg { int a,b; public: void input_add_val(int c, int d); void show(); void alter_sign(objarg x); }; void objarg::input_add_val(int c,int d) { a=c; b=d; //http://iubatians.blogspot.com } void objarg::alter_sign(objarg x) { x.a=-(a+b); cout<<"The negative value is ="<<x.a<<endl; } void objarg::show() { cout<<"The addition="<<(a+b)<<endl; }//http://iubatians.blogspot.com/ void main() { objarg w; w.input_add_val(15,36); w.show(); w.alter_sign(w); }span style='color:#200080; font-weight:bold; '