Last modified by chrisby on 2024/03/03 17:01

From version 2.4
edited by chrisby
on 2024/03/03 14:45
Change comment: There is no comment for this version
To version 3.2
edited by chrisby
on 2024/03/03 14:50
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -5,19 +5,23 @@
5 5   }
6 6  
7 7   type Circle struct {
8 - length float
8 + radius float
9 9   }
10 10  
11 11   func Area(g GeometricObject) float {
12 - switch (g.type()):
13 - case Circle:
14 - return
12 + switch type(g):
15 15   case Square:
16 - return ...
14 + return g.length * g.length
15 + case Circle:
16 + return PI * g.radius * g.radius
17 17   }
18 18  
19 19   func Circumference(g GeometricObject) float {
20 - ...
20 + switch type(g):
21 + case Square:
22 + return 4 * g.length
23 + case Circle:
24 + return 2 * PI * g.radius
21 21   }
22 22  
23 23  #### Object-Oriented Style