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

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

Summary

Details

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