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)!

C++ Declaring A Class

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 2609
Discussions: 200,962, Posts: 2,379,575, Members: 246,330
Old April 1st, 2003, 05:30 PM     #11 (permalink)
Senior Member
 
squeech's Avatar
 
Join Date: May 2002
Location: Rocky Mountain High
Posts: 613
In your initial post, you declared State as a variable of type bool. This means that you can only give it two values: true and false.

Since in your comments, you mentioned that the open state is represented by true, and closed by false, use that in the definition:
Code:
void BarrierType::BarrierOpen(void)
{
     State = true;
}

void BarrierType::BarrierClosed(void)
{
     State = false;
}
Two notes on these functions:
1) These two functions are members of the class, so they need to be named as associated with the class by the scope resolution operator ( :: ) like above: BarrierType::BarrierOpen()

2) Do not put semicolons after the function names. A semicolon is the period after a C++ sentence, and if it's there the compiler will not associate that line with the below class definition.


Also, FYI in case you care: The fancy names for these functions are "Accessors" because they give main and others access to private data
__________________
Talking in numbers doesn't make you smarter.
squeech is offline   Reply With Quote
Old April 1st, 2003, 06:34 PM     #12 (permalink)
Junior Member
 
Join Date: Mar 2003
Location: Florida USA
Posts: 18
Thanks squeech

Quote:
Also, FYI in case you care: The fancy names for these functions are "Accessors" because they give main and others access to private data

I'm only on Chapter 14!! Give me a chance

I'm nearly there now, just 2 to go

My thanks to everyone who gave me help/advice throughout, it was greatfully received.
Morphios 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? (2982)
The disrespect of Obama by Russian .. (46)
Making Health Care Worse (181)
Wireless Televisions. (12)
CPU fan stops spinning randomly (11)
Regular Build (11)
windows 7 problem (7)
Laptop with wireless problem. (6)
Point and Shoot Camera Suggestions. (6)
windows vista security holes (13)
Is the PSU I received dead? (13)
Print spooler problem (16)
radeon x850xt platinum & shader.. (6)
HIS HD5770 graphic card question (15)
Recent Discussions
Point and Shoot Camera Suggestions. (6)
Laptop with wireless problem. (6)
CPU fan stops spinning randomly (11)
Nvidia GTX 260 problem (1)
Modern Warfare 2: Who Bought It? (65)
Is the PSU I received dead? (13)
Print spooler problem (16)
windows vista security holes (13)
Kingston Bluetooth Dongle Driver (1)
Multiple Restarts Required at Boot (3)
Open With ..... Win7 (1)
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)
My monitor won't turn on after instal.. (1)
Internet Lost (3)
Dept. of HS: NSA 'Helped' Develop Vis.. (16)
Ideal cheap graph card for PC-Gaming? (18)
radeon x850xt platinum & shader 3 (6)
Graphics Card Upgrade Question (4)
For Sale BFG GTX285 OC2 with 10 year .. (3)


All times are GMT -4. The time now is 12:11 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