CSC/ECE 517 Fall 2012/ch1 1w22 an: Difference between revisions
Jump to navigation
Jump to search
(Created page with "== Introduction== ===subsection===") |
No edit summary |
||
Line 1: | Line 1: | ||
== Introduction== | == Introduction== | ||
== | When we define a method in a class and decide to call that method, how do we do it? | ||
We simply create an object of the class and pass the method name to the object as a message. The object then looks up into its method lookup path and tries to match the called method (passed as a message to the object) with the defined methods in the class. When there is a match, the method is executed along with the parameters passed and the result is returned. | |||
==What is a Method Lookup Path?== | |||
When the object receives a method name that is to be executed, these are the steps carried out for finding out that method called: | |||
* It looks in the current self object’s own instance methods. |
Revision as of 02:54, 9 September 2012
Introduction
When we define a method in a class and decide to call that method, how do we do it?
We simply create an object of the class and pass the method name to the object as a message. The object then looks up into its method lookup path and tries to match the called method (passed as a message to the object) with the defined methods in the class. When there is a match, the method is executed along with the parameters passed and the result is returned.
What is a Method Lookup Path?
When the object receives a method name that is to be executed, these are the steps carried out for finding out that method called:
- It looks in the current self object’s own instance methods.