The following code runs perfectly if it is in a standalone command line app:
如果是在一个独立的命令行应用程序中,下面的代码可以完美地运行:
extension Int {
func sayHello() {
println("Hello, I'm \(self)")
}
}
1.sayHello()
2.sayHello()
However, in playground, it won't run, and the error is "(2 times)". Can we not extend a class in playground or how do we do it?
然而,在操场上,它不会跑,错误是“(2次)”。我们能不能在操场上开设一个班,或者我们怎么做?