Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Discussion 4 - Nirav Shah
I am doing O-O Systems from the Summer 2003 review.
1. A class describes the implementation for a model/structure. It is basically a "blueprint" for an object. An instance on the other hand, is the actual implementation for the class. For example, if you are making an Airplane, the Airplane class will describe the attributes and methods that the Airplane can use (i.e. how many people it seats, how fast it can fly, etc.), while the Airplane object is the actual plane that you fly.
2. A class method is only used by a class, while an instance method is used only by an instance. For example, you can use class methods without having an instance of that class, as long as you have a class. However, you can use instance methods only if you have an instance of a class.
3. A class variable is unique to every class, while an instance variable is unique to every instance. For example, if you have a Dog class with a class variable called Color, all dogs will be the same color. However, if you change it to an instance variable instead, every dog can have its own color.
4. new is a class method, and initialize is an instance method.
Link to this Page