Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
19
Task/Polymorphism/Pop11/polymorphism-1.pop11
Normal file
19
Task/Polymorphism/Pop11/polymorphism-1.pop11
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
uses objectclass;
|
||||
define :class Point;
|
||||
slot x = 0;
|
||||
slot y = 0;
|
||||
enddefine;
|
||||
|
||||
define :class Circle;
|
||||
slot x = 0;
|
||||
slot y = 0;
|
||||
slot r = 1;
|
||||
enddefine;
|
||||
|
||||
define :method print(p : Point);
|
||||
printf('Point(' >< x(p) >< ', ' >< y(p) >< ')\n');
|
||||
enddefine;
|
||||
|
||||
define :method print(p : Circle);
|
||||
printf('Circle(' >< x(p) >< ', ' >< y(p) >< ', ' >< r(p) >< ')\n');
|
||||
enddefine;
|
||||
6
Task/Polymorphism/Pop11/polymorphism-2.pop11
Normal file
6
Task/Polymorphism/Pop11/polymorphism-2.pop11
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
;;; Initialize variables using default constructors
|
||||
lvars instance1 = newPoint();
|
||||
lvars instance2 = newCircle();
|
||||
;;; Use print method
|
||||
print(instance1);
|
||||
print(instance2);
|
||||
Loading…
Add table
Add a link
Reference in a new issue