有一个class BrokenPrinter {}
,使用extension
扩展它使支持这样的调用BrokenPrinter.print()
,且满足:
BrokenPrinter.print()
的时候使用 Swift 的print()
打印出字符串Hello, World.
BrokenPrinter.print()
,都不再有任何打印。额外要求:
1. 不要借助 Objective-C runtime
2. 不要使用 GCD
其实是下午写了类似的代码,然后下班路上忽然想到可以做成上面这样一道题
明天给出我自己的答案,在之前我想看看大家的(如果有兴趣的话)各种解答。