Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question in Swift. Consider the following class. class Person { let name : String init(name: String) { self.name = name } func speak () {
Question in Swift.
Consider the following class. class Person { let name : String init(name: String) { self.name = name } func speak () { print("Hello! My name is \(name).") } } Write a subclass of Person called Athlete that has an additional property called jerseyNumber. When an Athlete speaks, it should say that it plays hockey and tell its number. For example, var player Athlete (name: Henrik, jersey Number: 45) player.speak ( ) will print "Hello! My name is Henrik. I play hockey and I'm number 45Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started