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

Create the following protocols to solve the problem explained in Chapter 1, Objects from the Real-World to the Playground:

  • AbstractShape
  • AbstractRegularPolygon
  • AbstractEllipse
  • AbstractRectangle
  • AbstractCircle

After you create the protocols, create classes that implement them based on the specifications explained in Chapter 1, Objects from the Real-World to the Playground.

The following table summarizes the list of protocols to which each of the classes you must create will conform:

Class name

Conforms to the following protocol(s)

Shape

AbstractShape

Rectangle

AbstractRectangle and AbstractShape

RegularPolygon

AbstractRegularPolygon and AbstractShape

Ellipse

AbstractEllipse and AbstractShape

Circle

AbstractCircle ...

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