Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Abstract-type/Component-Pascal/abstract-type-1.pas
Normal file
11
Task/Abstract-type/Component-Pascal/abstract-type-1.pas
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
(* Abstract type *)
|
||||
Object = POINTER TO ABSTRACT RECORD END;
|
||||
|
||||
(* Integer inherits Object *)
|
||||
Integer = POINTER TO RECORD (Object)
|
||||
i: INTEGER
|
||||
END;
|
||||
(* Point inherits Object *)
|
||||
Point = POINTER TO RECORD (Object)
|
||||
x,y: REAL
|
||||
END;
|
||||
15
Task/Abstract-type/Component-Pascal/abstract-type-2.pas
Normal file
15
Task/Abstract-type/Component-Pascal/abstract-type-2.pas
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
(* Abstract method of Object *)
|
||||
PROCEDURE (dn: Object) Show*, NEW, ABSTRACT;
|
||||
|
||||
(* Implementation of the abstract method Show() in class Integer *)
|
||||
PROCEDURE (i: Integer) Show*;
|
||||
BEGIN
|
||||
StdLog.String("Integer(");StdLog.Int(i.i);StdLog.String(");");StdLog.Ln
|
||||
END Show;
|
||||
|
||||
(* Implementation of the abstract method Show() in class Point *)
|
||||
PROCEDURE (p: Point) Show*;
|
||||
BEGIN
|
||||
StdLog.String("Point(");StdLog.Real(p.x);StdLog.Char(',');
|
||||
StdLog.Real(p.y);StdLog.String(");");StdLog.Ln
|
||||
END Show;
|
||||
Loading…
Add table
Add a link
Reference in a new issue