home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

Passing a class object variable to another object variable

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 2875
Discussions: 200,968, Posts: 2,379,688, Members: 246,333
Old March 1st, 2002, 01:24 AM   Digg it!   #1 (permalink)
ILC
Senior Member
 
ILC's Avatar
 
Join Date: Oct 2001
Location: Eastern Shore
Posts: 701
Passing a class object variable to another object variable

Alright, have a project due, and would like to figure a little something extra.

I have to create a simple class that basically keeps track of billing for an electric company.

Say I have two variables of type billing declared in my driver file,
june, and july. Two of variables under each are curent_reading, and previous_reading. The default constructor sets each of those two values to 0.

Alright, lets say using function june.setCurrentReading(int value), I set june's current value. Now the question comes, for july, using the function july.setPreviousReading, I need it to equal june's current reading. How would you all go about doing this, I mean I know I could manually do it in the driver function (thats what we are expected to do at this point) but I would prefer to be able to do it in the class. Just say july.setPrevious Reading(); and have it automatically set.

Alright so does anyone understand waht im asking, or have I confused everyone?? Thanks.

ILC
ILC is offline   Reply With Quote
Old March 1st, 2002, 02:10 AM     #2 (permalink)
The Mad Redhatter
 
storm2k's Avatar
 
Join Date: Oct 2001
Location: NJ
Posts: 3,552
Send a message via ICQ to storm2k Send a message via AIM to storm2k Send a message via MSN to storm2k Send a message via Yahoo to storm2k
just have that july function call the june one (once the june one is set by some other means)... you can do that and it shouldn't complain...

say you have an internal value reading and you could set that to the june function (juat make some way for you to input the june thing then you can do july)...
storm2k is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (3030)
Forty-six years ago today (12)
Breaking: San Diego ACORN Document .. (5)
Laptop with wireless problem. (12)
Wireless Televisions. (12)
CPU fan stops spinning randomly (11)
Regular Build (11)
windows vista security holes (16)
Internet Lost (5)
windows 7 problem (7)
Is the PSU I received dead? (13)
Point and Shoot Camera Suggestions. (6)
radeon x850xt platinum & shader.. (6)
HIS HD5770 graphic card question (15)
Recent Discussions
Help getting around port 80 for camer.. (5)
Skillsoft Network+ Study Software Que.. (10)
Browsers wont load websites (3)
Nvidia GTX 260 problem (2)
windows vista security holes (16)
Delete an OS (8)
help me pls laptop just stopped worki.. (0)
Open With ..... Win7 (3)
Laptop with wireless problem. (12)
Internet Lost (5)
virus blocking exe. files (1)
Point and Shoot Camera Suggestions. (6)
CPU fan stops spinning randomly (11)
Modern Warfare 2: Who Bought It? (65)
Is the PSU I received dead? (13)
Print spooler problem (16)
Kingston Bluetooth Dongle Driver (1)
Multiple Restarts Required at Boot (3)
webcam (0)
upgrade for hp a6101 (0)
tv not turn on-makes clicking sound (2)
EVGA 9800 gtx help with finding a goo.. (11)
Regular Build (11)
Help with onclick and buttons (0)
Virus advise (8)


All times are GMT -4. The time now is 05:02 PM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28