November 2013
Beginner
325 pages
9h 47m
English
You learned in Chapter 20 that when you send a message to an object, the object’s class is asked if it has a method with that name. The search goes up the inheritance hierarchy until a class responds with “Yeah, I have a method with that name.”
Figure 27.4 The search for a method with the right name
As you can imagine, this search needs to happen very, very quickly. If the compiler used the actual name of the method (which could be very long), method lookup would be really slow. To speed things up, the compiler assigns a unique number to each method name it encounters. At runtime, it ...
Read now
Unlock full access