O'Reilly logo

Swift 3 ObjectOriented Programming - Second Edition by Gastón C. Hillar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required