Chapter 4 Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Private

A

The private keyword denotes the least stable kind of method and provides the most restricted visibility. Private methods must be called with an implicit receiver, or, inversely, may never be called with an explicit receiver.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Protected

A

The protected keyword also indicates an unstable method, but one with slightly different visibility restrictions. Protected methods allow explicit receivers as long as the receiver is self or an instance of the same class or subclass of self.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The Law of Demeter (LoD)

A

The Law of Demeter (LoD) is a set of coding rules that results in loosely coupled objects. Loose coupling is nearly always a virtue but is just one component of design and must be balanced against competing needs. Some Demeter violations are harmless, but others expose a failure to correctly identify and define public interfaces.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The Law of Demeter (LoD)

A

The Law of Demeter (LoD) is a set of coding rules that results in loosely coupled objects. Loose coupling is nearly always a virtue but is just one component of design and must be balanced against competing needs. Some Demeter violations are harmless, but others expose a failure to correctly identify and define public interfaces.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly