O'Reilly logo

Swift Programming: The Big Nerd Ranch Guide by John Gallagher, Matthew Mathias

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

Silver Challenge

Create another subclass of the Monster type. Call this one Vampire.

Override the terrorizeTown() method so that every time an instance of the Vampire type terrorizes a town, it adds a new vampire thrall to an array of vampires on the Vampire type. This array of vampire thralls should be empty by default. Terrorizing a town should also decrement the town’s population by 1.

Last, exercise this Vampire type in main.swift.

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