© 2012 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu
Quick Links
Easy Studies
« NS2  Projects »

Home Lab Exercise Object Oriented Programming Lab Exercise ProgramsCPP Program For Unary Operator Overloading▼


CPP Program For Unary Operator Overloading

Alogarithm steps:

    Step 1: create the class loc.

    Step 2: Declare the constructor loc .which initialize the member variables.

    Step 3: Declare the member operator functions with the keyword operator.

    Step 4: Define the user specified operator’s behavior in operator function definitions.

    Step 5: Create the objects for the class loc.

    Step 6: Use the user defined operators for objects.

    Step 7: Monitoring the output values.

CPP Program For Unary Operator Overloading

#include class loc { int longtitude,latitude; public: loc(); loc(int lg,int lt) { longtitude = lg; latitude=lt; } void show() { cout<

SAMPLE INPUT AND OUTPUT:

10 20
5  30
11 21
12 22
12 22
90 90
90 90

 
SLogix Student Projects

⇓ Student Projects ⇓
⇑ Student Projects ⇑
bottom