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 Groves

Question "OO Theory" from midterm review fall 2002

1) What is a class? What is an instance?

A class is a definition in code for an object, and an instance is the actual object. A class acts like the architectural blue print for a building, and the instance is the building itself. Only on class is needed for many instances to exist.

2) What is the difference between a class and instance method?

A class method is one that in not specific to a instance of the class, and can be accessed by referencing the class, and not a given instance of the class. A class method would only be able to access class variables. An instance method is a method that can only be called by referencing a specific instance of a class, and it can access variable specific to that instance as well as class variables.

3) What is the difference between a class and instance variable?

A class variable is a variable that is not specific to any instance of a class, only one copy of a class variable exists regardless of the number of instances of a class there are, and all instances access the same variable. An instance variable is specific to an instance of a class, so if an instance changes one of its instance variable that change doesn't affect any other instances in existence.

Links to this Page