Created
December 4, 2017 18:01
-
-
Save SiarheiFedartsou/0b52e0afa4a2b8b1781f579fb2fca3db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct SquareShapeVisitor: ShapeVisitor { | |
func visit(_ rectangle: Rectangle) -> Float { | |
return rectangle.width * rectangle.height | |
} | |
func visit(_ circle: Circle) -> Float { | |
return circle.radius * circle.radius * Float.pi | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment