Thread: Classes
View Single Post
Old March 4th, 2009, 04:08 PM
iceman90289 iceman90289 is offline
Friend of Wrox
Join Date: Mar 2008
Location: So Cal is good enough for you, California, USA.
Posts: 133
Thanks: 15
Thanked 1 Time in 1 Post
Send a message via ICQ to iceman90289 Send a message via AIM to iceman90289

if you look at the code example carefully in your book you will see things like

// Keep an eye out for this variable name okay?
private int myprivateVar = 1;
// this is a property, its a variable declaration that LOOKs like a function but its not.
// it gets a value of a private variable or changes it.
public Name
       // myprivateVar is used in these braces
and it is used like so:

className.Name = "Jim Carrey"
// or
string name = className.Name.ToString() // you may or may not need ToString()

and there you have it, as far as fields go... i would say they are variables that affect the behavior of a class like... lets say you had a class controlling how many monsters to spawn behind the player.

cMonsterSpawner.NumberToSpawn = 5;
now i might be a little bit ignorant but to me they are almost the same things. almost.
The Following User Says Thank You to iceman90289 For This Useful Post:
dotnetDeveloper (March 4th, 2009)