Smalltalk в примерах/Сообщения: различия между версиями
Содержимое удалено Содержимое добавлено
Строка 156:
-->
==Что происходит, когда
Когда сообщение посылается объекту, Smalltalk
<!--
What happens when a message is sent
When a message is sent to an object, the Smalltalk system looks to see if a method with that name exists for that type of object (in other words, has been written and stored in the class of the object). If there is a method, it is executed. If no method of that name is defined in the object's class, the system looks in the method dictionary for its immediate superclass. If there is no method with that name in the superclass it looks in the superclass's superclass.
The method lookup keeps working its way up the superclass hierarchy until it finds a method with that name,which it then executes. If it reaches Object and still doesn't find a method, it displays a Notifier window that gives you an opportunity go into a Debugger and figure out what went wrong.
-->
▲Метод ищется в иерархии суперклассов до тех пор пока не найдётся метод с этим именем, который и выполняется. Если достигнут класс Объект и в нём не найден метод, Объект показывает окно Сообщения позволяя тебе запустить отладчик и узнать что произошло\footnote{Что в действительности происходит когда метод не найден, посылается сообщение неПонял:. Если этот метод не переопределён он заставляет Объект вызвать исключение. !!!}.
==Получатель сообщения==
|