Overloading unary operators, C/C++ Programming

Overloading Unary Operators

class sign

{int a,b,c;

public:

sign(){}; sign(int,int,int); void putdata(void);

void operator-();

};

void sign::operator-()

{a=-a;b=-b;c=-c;           }

void sign::putdata(void)

{cout<<"a is: "<

}

sign::sign(int x,int y, int z)

{a=x;b=y;c=z;                          }

int main()

{           sign s; s=sign(1000,2,10); s.putdata();

-s; s.putdata(); cout<

s=sign(-2000,2,-5);

s.putdata();

-s;

s.putdata();

return 0;

}

Posted Date: 9/20/2012 8:17:37 AM | Location : United States







Related Discussions:- Overloading unary operators, Assignment Help, Ask Question on Overloading unary operators, Get Answer, Expert's Help, Overloading unary operators Discussions

Write discussion on Overloading unary operators
Your posts are moderated
Related Questions

What are all of the implicit member functions of the class? Or what are all of the functions that compiler implements for us if we don't describe one? A: 1.      copy ctor

Project Description: I would like to be building regarding a complex mobile application build as we require the signing of an NDA. My firm in based in Montreal Canada and we are

superposition of two waves


Newton's method for cube roots is based on the fact that if y is an approximation to the cube root of x, then a better approximation is given by the value: (x/y 2 +2y)/3 (a)

The continue statement The continue statement causes the next iteration of the enclosing loop to start. When this is encountered in the loop , the rest of the statements in the

Develop a C++ program that uses a while to determine the gross pay (in Dollars) for each of several employees. The company pays “straight-time” for the first 40 hours worked by eac

I need Decompile Library(.DLL or .SO) into source code Project Description: I am seeking an experienced programmer or anyone who knows a thing or two about reverse engineerin

Ask question #Minimum 100 write an algorithm to calculate simple interest and compound interestwords accepted#