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
THEORY OF A COMPUTER PROGRAMMING

i need amibroker afl to dll plugin

Exceptions. Your SVector class should throw four exceptions: 3.1. If the constructor size is invalid, then it will just allow the implicit STL bad_alloc exception to pass up to mai

world wide web

Asks the user for an integer. if the number is less than 21, ask them for a number again; repeat this until you get a number bigger than 20. 20 is not an acceptable number. Once yo

Can I free() pointers allocated  along with new? Can I delete pointers allocated along with malloc()? A: No. It is completely legal, moral, and wholesome to employ malloc() a

Program is to display the contents of file on a screen: Write a program to display the contents of file on a screen void main()   {  clrscr();  ifstream fin("ascii

THEORY OF COMPUTER PROGRAMMING

Differentiate between functions getch () and getche (). - Both functions accept a character input value from user. - When getch () is used, key that was pressed won't appear

This is what I need help with. "Create a program creates an interface allowing the user to select from some other programs I have made one being a money converter and the other ca