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

Fall2004 Midterm Review: O-O Systems

1. The class is a blueprint for all object of a specific type, grouping attributes and services. An instance on the other hand, is an object explicitly created based on a class. -Jason Sirichoke

(Out of the book) A class is a blueprint that defines how to build objects of the same kind. An instance is a an object created using the class blueprint. -the nUb - Jose Caban

Box is a class. Joe is an instance. – Patrick Jarrett

the first 2 sound good. the last one probably wouldn't get full credit, but its certainly not wrong.-ellie

2. Instance methods can operate on the current instance of the class and can also have access to class variables. Class methods cannot access instance variables. -Jason Sirichoke

Class methods do not require an instantance of the class to be executed. Instance methods are executed under the context of the current instance of the class to which the message is sent. Class variables are available to both types of methods, instance variables can only be accessed by instance methods. -the nUb - Jose Caban

yes, sounds good. its important to point out that class methods have access only to class variables and other class methods, and instance methods have access to both class and instance variables and methods. jose's answer is perhaps a bit more complete. -ellie

3. Instance variables are created each time you create a new instance of the class while a class variable is only declared once per class regardless of the number of instances created of that class. All instances share one copy of the class variables. In Java, this would be the equivalent of using static. -Jason Sirichoke

Class variables are available to the class without instantiating an instance of the class. They are available to both instance and class methods. Instance variables are unique to each instance object of the class. -the nUb - Jose Caban

yep. sounds pretty good -ellie

4. New is a class method while initialize is an instance method. -Jason Sirichoke

new is a class method, initialize is an instance method. new returns a new instance of class Box, which is then sent the initialize method. -the nUb - Jose Caban

Link to this Page