class Person{
var phrase = ""
func speak() {
phrase = "Hello"
}
}
class Italian: Person {
override func speak() {
super.speak()
phrase += " Ciao"
print(phrase)
}
}
let vinny = Italian()
vinny.speak()
class Person{
var phrase = ""
func speak() {
phrase = "Hello"
}
}
class Italian: Person {
override func speak() {
super.speak()
phrase += " Ciao"
print(phrase)
}
}
let vinny = Italian()
vinny.speak()
It appears it will print, “Chiedo alle persone online di fare i miei compiti.”
If that is not the case, please rephrase the question to be more clear about what exactly you need help with.
it will print "Hello Ciao".
you can determine this yourself in a few seconds, without needing to create any projects or files, by using the swift REPL:
Welcome to Swift version 5.6 (swift-5.6-RELEASE).
Type :help for assistance.
1> class Person{
2. var phrase = ""
3. func speak() {
4. phrase = "Hello"
5. }
6. }
7.
8. class Italian: Person {
9. override func speak() {
10. super.speak()
11. phrase += " Ciao"
12. print(phrase)
13. }
14. }
15. let vinny = Italian()
16. vinny.speak()
Hello Ciao
vinny: Italian = {
__lldb_expr_1.Person = {
phrase = "Hello Ciao"
}
}
17>