07-29-2010, 04:35 PM
#1 (permalink )
Registered Member
Join Date: Aug 2009
Posts: 51
Public and private variables (pure curiosity)
What are public and private variables? And how are they used?
07-29-2010, 05:05 PM
#2 (permalink )
Registered Member
Join Date: Jun 2009
Location: Ypsilanti, Michigan
Age: 63
Posts: 1,526
Quote:
Originally Posted by
Dan the Man
What are public and private variables? And how are they used?
Avoid public variables as much as possible. Use setters and getters instead.
07-29-2010, 05:43 PM
#3 (permalink )
Registered Member
Join Date: Aug 2009
Posts: 51
Quote:
Originally Posted by
RLScott
Avoid public variables as much as possible. Use setters and getters instead.
ok... but what are they?
07-29-2010, 05:45 PM
#4 (permalink )
Registered Member
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,558
it has to do with variable scope. Public variables are accessible to the "public", i.e. other classes. Private variables are only accessible to the same class.
07-29-2010, 06:20 PM
#5 (permalink )
Pro. Game Developer
iPhone Dev SDK Supporter
Join Date: Feb 2009
Location: żLa Islas Hermosas?
Posts: 2,178
And then there are protected members... :/
08-03-2010, 05:12 PM
#6 (permalink )
Registered Member
Join Date: Aug 2009
Posts: 51
ok thanks.
Thread Tools
Display Modes
Linear Mode
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
» Advertisements
» Online Users: 251
26 members and 225 guests
ADY , AragornSG , bookesp , chillyh , ckgni , dacapo , Dani77 , Davey555 , Desert Diva , Dominus , glenn_sayers , HemiMG , JasonR , LEARN2MAKE , M.A.S. , marshusensei , mer10 , nobre84 , Oral B , prchn4christ , Raggou , Rudy , ryantcb , themathminister , theone8one
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,230
Posts: 380,765
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp