Reputation: 326
I have two question regarding code below:
final class God {
class func eat() {
print("Om nom nom")
}
static func throwLightning() {
print("Zzap")
}
}
eat()
method without removing final
keyword from God
class?class
and static
funcs in classes marked as final
?UPDATE:
Is there any difference from method dispatch point of view?
Upvotes: 0
Views: 57
Reputation: 535316
Is it possible to override
eat()
method without removingfinal
keyword from God class?
No. "override" is something you do in a subclass. But final
means there can be no subclasses, so where would this "override" even occur?
Is there any difference between
class
andstatic
funcs in classes marked asfinal
?
No, not from a Swift programmer's point of view. static
means class final
. But this class is already final
, so saying static
adds nothing.
Upvotes: 1