Avatar
(edited)
Author icon
rintaro
class Base { func foo(x: Int = 12) {} } class Derived : Base { override func foo(x: Int = 42) { print(x) } } func test1(obj: Base) { obj.foo() } func test2(obj: Derived) { obj.foo() } test1(obj: Derived()) test2(obj: Derived())
Version:
swift-4.2.1-RELEASE
Output:
12 42
Error: