Smalltalk в примерах/Переменные: различия между версиями

Содержимое удалено Содержимое добавлено
Выкинул "рисунки"
Строка 452:
г просмотреть.
 
В данном примере, мы присваиваем один и тот жэ экзэмпляр УпорядоченнойСовокупности всем переменным. Когда мы изменяем совокупность через одну переменную, её содержымое изменяется и эти изменения видны всем переменным которые содержат эту совокупность. Это показано на Рисунке~\ref{odinOb7ekt}.
 
<!--
In this example, we assign the same instance of OrderedCollection to all the variables. When we modify the collection via one variable, its contents are changed and that change is visible to all variables that have been bound to it. This is illustrated in Figure 4-1.
-->
 
\begin{figure}[!htb]
\begin{center}
\includegraphics{odinOb7ekt.eps}
\end{center}
\caption{Все переменные содержат один объект}
\label{odinOb7ekt}
\end{figure}
 
С другой стороны, если мы сделаем следующее, мы увидим что б содержыт число 2, в то время как г содержыт числа 1 и 3.
Строка 480 ⟶ 468 :
г просмотреть.
 
В этом примере, мы присвоили различные значения б, и связали с ней объект 2 вместо экзэмпляра УпорядоеннойСовокупности. Это показано на Рисунке~\ref{raznyeOb7ekty}.
 
<!--
In this example, we assign a different value to b, and bind it to the object 2 instead of the instance of OrderedCollection. This is illustrated in Figure 4-2.
-->
 
\begin{figure}[!htb]
\begin{center}
\includegraphics{raznyeOb7ekty.eps}
\end{center}
\caption{Переменные содержат различные объекты}
\label{raznyeOb7ekty}
\end{figure}
 
==Методы доступа==
Строка 672 ⟶ 648 :
<!--
This leads to the idea that to maintain loose coupling between classes, a method should send messages only to self, super, to its class, to instance or class variables, to a parameter, or to an object it creates. If the method sends messages to any other object it is either referencing a global variable, or it knows something about the internal details of the object. This is illustrated in Figure 4-3.
-->
 
\begin{figure}[!htb]
Строка 681 ⟶ 656 :
\label{loose}
\end{figure}
-->
 
==Документирование при помощи имён==