View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Discussion 4 - Michael Federici

What is a class? What is an instance?
What is the difference between a class and instance method?
What is the difference between a class and instance variable?

A class consists of a collection of types of encapsulated instance variables and types of methods, possibly with implementation of those types together with a constructor function that can be used to create objects of the class. An instance is an instance of a class. That is, it is a singular object of a particular class type.

A class method is a method that applies to the class, whereas an instance method affects only a singular instance of the class. for example:

a := BookMorph new
here we are calling the method new on the class bookmorph
a := openInWorld
here we are calling the method openInWorld on the instance of bookmorph called a.

a class variable is a variable that would belong to a class but would not be accessible by any of its instances. An instance variable would be any variable that would be used by an instance of a class.

Link to this Page