These are flashcards an notes made by students on topics like 'value', 'member' and 'field', originating from:

- Michael Jesse Chonoles
ISBN-10 0128096403 ISBN-13 9780128096406
1335 Flashcards & Notes
  • This + 400k other summaries, also in PDF!
  • A unique study and practice tool
  • Never study anything twice again
  • Get the grades you hope for
  • 100% sure, 100% understanding
Remember faster, study better. Scientifically proven.
Trustpilot Logo

Study Cards on value, member, field

It is also possible to assign a default value to a property.

In Fig. 6.11, we modify the hasAdultPrivleges Boolean flag to have a default value of False.

What does it mean? 
This means that whenever we created a new Member instance, the flag will be given an initial value of False.
Give an example of why it might be useful to use the default value?
This helps us because whenever the Member tries to borrow an adult book, we would check the value of the flag.

If the field is False, we would then call the isAdult() operation.

If the Member is an adult, then we flip the flag, so that the next time the Member tries to borrow an adult book, we will see that the Member already has permission.
The birthday field is marked private. The value is available ..... Where?
Note that even though the birthdate field is marked private (-), the value is available inside to operations on Member.

Therefore, the isAdult() operation can read the birthdate field.
  • Higher grades + faster learning
  • Don't study anything twice
  • 100% sure, 100% understanding
Discover Study Smart