Creating Variables
In this hour, you are looking at a class of objects called Virus whose sole purpose in life is to reproduce in as many places as possible—much like some people I knew in college. A Virus has several different things it needs to do its work, and these are implemented as the behavior of the class. The information that’s needed for the methods are stored as attributes.
The attributes of an object represent variables needed for the object to function. These variables could be simple data types such as integers, characters, and floating-point numbers, or they could be arrays or objects of classes such as String or Calendar. You can use an object’s variables throughout its class, in any of the methods the object contains. By convention, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access