HOME BZU Mail Box Online Games Radio and TV Live Cricket Score All Albums
Go Back   BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan Institute of Computing Bachelor of Science in Information Technology BsIT 3rd Semester Object Oriented Programming

Object Oriented Programming By Mam Sidra Malik


Reply
 
Thread Tools Search this Thread Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1  
Old 24-10-2008, 03:59 PM
shmsa's Avatar
Grown up punk

 

Join Date: Oct 2007
Location: Muslim Town Multan
Posts: 195
Contact Number: 0322-6196713
Program / Discipline: BSIT
Class Roll Number: 07-22
shmsa is a jewel in the roughshmsa is a jewel in the roughshmsa is a jewel in the roughshmsa is a jewel in the rough
Read How to use Uniry Operator on class objects using C++


#include <iostream> using namespace std; class product { private: int count; public: void getcount() { cout<<"Plz enter the value of count = "; cin>>count; } product (): count(6) { } void operator ++() { ++count; cout<<"it is pre increment"<<endl; } void operator ++(int) { count++; cout<<"it is post increment"<<endl; } void show() { cout<<"the value of count after increment is = "<<count<<endl; } }; class product1 { private: int count; public: void getcount() { cout<<"Plz enter the value of count = "; cin>>count; } product () {count=6;} void operator --() { --count; cout<<"it is pre decrement"<<endl; } void operator --(int) { count--; cout<<"it is post decrement"<<endl; } void show() { cout<<"the value of count after decrement is = "<<count<<endl; } }; void main() { product p; p.getcount(); ++p; p.show(); p.getcount(); p++; p.show(); product1 p1; p1.getcount(); --p1; p1.show(); p1.getcount(); p1--; p1.show(); }
it is done in 2 classes it can also be done in 1 class
Reply With Quote
Reply

Tags
class, objects, operator, uniry


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Light Convert 2-D Patterns Into 3-D Objects Kamzkami Tech world 0 11-11-2011 08:09 PM
Proposal of a 3th class boy to 9th class girl. usman_latif_ch Funny Cut Piece 0 02-11-2011 07:13 PM
HP TopShot LaserJet Pro multifunction lets you scan 3D objects .BZU. Tech world 0 11-09-2011 07:22 AM
The C++ Modulus Operator bonfire Introduction to Computing 0 26-02-2011 11:15 PM
Use of Binary Operator on class objects using C++ shmsa Object Oriented Programming 0 24-10-2008 04:04 PM

Best view in Firefox
Almuslimeen.info | Cloud Computing | Dedicated server hosting
Note: All trademarks and copyrights held by respective owners. We will take action against any copyright violation if it is proved to us.

All times are GMT +5. The time now is 01:44 AM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.