Changes for page Code Example: Data Structure Style vs. Object Style
Last modified by chrisby on 2024/03/03 17:01
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,10 +8,3 @@ 1 -### Use Cases 2 - 3 -This example is intended to demonstrate the extensibility differences between data structures and objects by extending them with 4 - 5 -1. an Area() function (extending behavior) 6 -1. a rectangle type (extending data type) 7 - 8 8 ### Data Structure Style 9 9 10 10 type Square struct { ... ... @@ -23,10 +23,8 @@ 23 23 return 2 * PI * g.radius 24 24 } 25 25 26 - 1.19 +* 27 27 28 -#### 29 - 30 30 #### Object-Oriented Style 31 31 32 32 interface GeometricObject {