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 and AbstractShape

EquilateralTriangle

AbstractRegularPolygon and AbstractShape

Square

AbstractRegularPolygon and AbstractShape

RegularHexagon

AbstractRegularPolygon and AbstractShape

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.214.32