Navigation:  Tutorials > Beginners Guide to Smalltalk > Objects and Messages > Variables and Assignments >

Instance Variables

Previous pageReturn to chapter overviewNext page

Objects have to hold their state information somewhere, and instance variables are the place. An object can contain one or more variable slots where its internal data is kept. Instance variables are private to the object in question and are not exposed to the outside world. This allows the object to keep its internal representation hidden so its users don't come to rely on it. Since it is not permissible for a user to manipulate another object's instance variables so messages become the only means to communicate with it. This encapsulation is a very important principle behind Object Oriented Programming.

I'll show you how to create and use instance variables in the chapter on Classes and Methods.