50 lines
1.3 KiB
HTML
50 lines
1.3 KiB
HTML
<html>
|
|
<head>
|
|
<link rel=stylesheet type="text/css" href="styles.css">
|
|
</head>
|
|
<body>
|
|
<H2>
|
|
Pascal samples. Script-defined class types.
|
|
</H2>
|
|
<hr>
|
|
|
|
<blockquote>
|
|
<pre>
|
|
<font color="blue"><b>uses</b></font>
|
|
Classes;
|
|
<font color="blue"><b>type</b></font>
|
|
TMyComponent = <font color="blue"><b>class</b></font>(TComponent)
|
|
<font color="blue"><b>procedure</b></font> Show; <font color="blue"><b>virtual</b></font>; <font color="blue"><b>abstract</b></font>;
|
|
<font color="blue"><b>end</b></font>;
|
|
|
|
TMyClass = <font color="blue"><b>class</b></font>(TMyComponent)
|
|
<font color="blue"><b>procedure</b></font> Show; <font color="blue"><b>override</b></font>;
|
|
<font color="blue"><b>end</b></font>;
|
|
|
|
<font color="blue"><b>procedure</b></font> TMyClass.Show;
|
|
<font color="blue"><b>begin</b></font>
|
|
writeln(<font color="Red">'TMyClass'</font>);
|
|
<font color="blue"><b>end</b></font>;
|
|
|
|
<font color="blue"><b>var</b></font>
|
|
X: TMyComponent;
|
|
<font color="blue"><b>begin</b></font>
|
|
X := TMyClass.Create(<font color="blue"><b>nil</b></font>);
|
|
X.Name := <font color="Red">'abc'</font>;
|
|
writeln(X.Name);
|
|
X.Show;
|
|
X.Free;
|
|
<font color="blue"><b>end</b></font>.
|
|
</pre>
|
|
</blockquote>
|
|
|
|
|
|
<p>
|
|
<HR>
|
|
<font size = 1 color ="gray">
|
|
Copyright © 2006-2009
|
|
VIRT Laboratory. All rights reserved.
|
|
</font>
|
|
</body>
|
|
</html>
|