Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- do {
- class A {
- }
- class B : A {
- }
- class C : B {
- }
- func test(f: (C) -> A) -> String {
- return "Passed"
- }
- let closure1: (A) -> A = { _ in A() }
- let closure2: (B) -> B = { _ in B() }
- test(f: closure1) // "Passed"
- test(f: closure2) // "Passed"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement