Created
July 29, 2020 07:10
-
-
Save nkmrh/f45fe881c6a7e3e9bcfe43b4c528791b to your computer and use it in GitHub Desktop.
レガシーコード改善ガイド 4.2 接合部
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
class Hoge { | |
func fuga() { | |
// ......................... | |
// ......................... | |
// ......................... | |
// ......................... | |
let v = min(2, 1) | |
print(v) | |
// ......................... | |
// ......................... | |
// ......................... | |
// ......................... | |
} | |
func min(_ x: Int, _ y: Int) -> Int { | |
return Swift.min(x, y) | |
} | |
} | |
class TestingHoge: Hoge { | |
override func min(_ x: Int, _ y: Int) -> Int { | |
return 1000 | |
} | |
} | |
Hoge().fuga() // 1 | |
TestingHoge().fuga() // 1000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment