begin
self.number := self.number + 1;
end;
...WOW! what an amazing procedure! So all of the variables of type 'thing' will
have that method at their diposal. You call the method by going [variable name
here].incNumber or whatever the procedure happens to be called.There are also
special kinds of procedures called constructors and destructors.
Constructors are supposed to happen when the object is created and destructors
when it is deleted. But since pascal treats objects like variables these must be
called on like a normal procedure. I don't see any particular need to use them,
except that they may increase readability of your code.
|