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
- Michael Groves last edited on 9 October 2005 at 5:13 pm by user-1121cbe.dsl.mindspring.com
- Fall 2005 Discussion 4 last edited on 6 December 2005 at 3:45 pm by r36h51.res.gatech.edu