Exercises
Now that you understand instance properties, type properties, and methods, it is time to spend some time in the Playground, the Swift REPL, or the Sandbox, creating new classes and instances:
Exercise 1: Create mutable versions of the following three classes that we analyzed in Chapter 1, Objects from the Real-World to the Playground:
Equilateral triangle (The
EquilateralTriangle
class)Square (The
Square
class)Regular hexagon (The
RegularHexagon
class)
Exercise 2: Create immutable versions of the previously created classes