\b{figure}[htbp]
\caption{Creating an instance of an object}
\setlength{\unitlength}{1cm}
\setlength{\unitlength}{1cm}
\b{tabular}[t]{r @{\hspace{0.1cm}}p{12.5cm}}
&
\b{picture}(12.5,10.5)(1.3,1)
\put(3,3){ \oval(3.0,2.0) }
\put(4.5,3.8){\line(5,2){2.0} }
\put(1.4,2.6){ \makebox(3,2){ constructor } }
\nop{
\put(1.5,1.5){
\makebox(3,3){
\b{tabular}[b]{|r|l|}
\e{tabular}
} }
}
\put(8,5){
\makebox(4,5){
\b{tabular}[b]{|r|r@{\hspace{0.1cm}}p{2.5cm}|}
\multicolumn{3}{|c|}{\x {\bf object {M (ctr,n) M} } }
\\ \hline \hline
{M variable M} & n = & 0 \\
\cline{2-3}
{M constructor M} &
ctr(N):- & \\ & & accept(any),\n ctr().
\\ \cline{2-3} \cline{2-3}
\x {M methods M} &
inc():- & n = n + 1. \\
\x & dec():- & n = n - 1. \\
\x & value(N):- & N = n. \\
\multicolumn{3}{|c|}{ {M state information M} }
\\ \hline
{M accept list M} & \multicolumn{2}{p{3.5cm}|}{ ctr } \\ \hline
{M accept queue M} & \multicolumn{2}{p{3.5cm}|}{ empty } \\ \hline
\multicolumn{3}{|l|}{ }
\\ \hline
\e{tabular}
} }
\e{picture}
\\ \\
\it explanation &
\multicolumn{1}{p{12.5cm}}{
\small When an instance of an object is created, a copy
is made of the object declared in the program.
Each instance has its own non-logical (instance) variables.
The goal succeeds as soon as the new object
is created, the variable O is then bound to that object.
At the same time, the constructor process is started
for the newly created object.
The constructor process evaluates the goal .
In general a constructor goal may have arguments.
Since the is initially set to accept
a method with the name of the object, the constructor
goal will be the first goal that is accepted.
Other goals will then be put in the accept queue to
await a proper accept statement.
} \\ %%\cline{2-2}
\e{tabular}
\e{figure}