CPSC 233 Lecture Notes - Lecture 10: In C

27 views2 pages

Document Summary

An object has a life-time: created with the (cid:862)new(cid:863) operator and a constructor, garbage collected when there are no longer any references to it. In java, an object is passed by reference: the receiving object acts directly on the state of the object passed in, not on a copy of the object. If you want a copy of an object, use the clone() method fluffy == scratch tests if the labels refer to the same object: use the equals() method to compare the state of two objects. Is a set of objects that share a common structure and a common behavior: have common attributes (instance variables) But usually different values for these attributes: have common methods (instance methods) A class is an abstraction, a way of classifying similar objects. Sometimes we treat the calss as an object: we send messages to it. (i. e. ) invoke a class (static) method: we store data in it. Is the outside view of a class.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions