Data update
This commit is contained in:
parent
0df55f9f24
commit
aec8ed51b6
1045 changed files with 18889 additions and 2777 deletions
44
Task/Polymorphism/FreeBASIC/polymorphism.basic
Normal file
44
Task/Polymorphism/FreeBASIC/polymorphism.basic
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
Type PPoint
|
||||
x As Integer
|
||||
y As Integer
|
||||
End Type
|
||||
|
||||
Type CCircle
|
||||
p As PPoint
|
||||
r As Integer
|
||||
End Type
|
||||
|
||||
Sub PointInit (pthis As PPoint Ptr, x0 As Integer, y0 As Integer)
|
||||
pthis->x = x0
|
||||
pthis->y = y0
|
||||
End Sub
|
||||
|
||||
Sub CircleInit (pthis As CCircle Ptr, x0 As Integer, y0 As Integer, r0 As Integer)
|
||||
pthis->p.x = x0
|
||||
pthis->p.y = y0
|
||||
pthis->r = r0
|
||||
End Sub
|
||||
|
||||
Sub PointPrint (pthis As PPoint Ptr)
|
||||
Print "Point at (" & pthis->x & ", " & pthis->y & ")"
|
||||
End Sub
|
||||
|
||||
Sub CirclePrint (pthis As CCircle Ptr)
|
||||
Print "Circle at center(" & pthis->p.x & ", " & pthis->p.y & "), radius " & pthis->r
|
||||
End Sub
|
||||
|
||||
Dim As Integer i
|
||||
Dim As PPoint points(3)
|
||||
Dim As CCircle circles(4)
|
||||
|
||||
For i = 0 To 3
|
||||
PointInit(@points(i), i, i+1)
|
||||
PointPrint(@points(i))
|
||||
Next
|
||||
|
||||
For i = 0 To 4
|
||||
CircleInit(@circles(i), i, i+1, i+2)
|
||||
CirclePrint(@circles(i))
|
||||
Next
|
||||
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue