Hi, Can someone tell me the difference between public, private, and static variables? When should they be used. I actually believe i understand static vars. But not the use of public and private.
Public members are accessible from other classes
Private members are accessible only from within the class itself
Static members belong to the type/class instead of an instance - i.e. there is only one of them shared between all instances of a class
You can also use protected and internal - protected members are available from inheriting classes, internal works for other classes in the same assembly. These two probably aren't as interesting for you than the others though