
只是为了澄清匿名类在Java示例这里 – http://docs.oracle.com/javase/tutorial/java/javaOO/anonymousclasses.html
谢谢!
据我所知,没有等效的语法。关于等效的技术,理论上你可以使用闭包并在其中定义结构体和类。可悲的是,我不能让这在一个 *** 场或项目中工作,而不会使其崩溃。很可能这还没有准备好在目前的测试版中使用。
就像是…
protocol SomeProtocol { func hello()}let closure : () -> () = { class NotSoAnonymousClass : SomeProtocol { func hello() { println("Hello") } } let object = NotSoAnonymousClass() object.hello()} …目前输出此错误:
invalID linkage type for global declaration%swift.full_heapMetadata* @_TMdCFIv4Test7closureFT_T_iU_FT_T_L_19NotSoAnonymousClassLLVM ERROR: broken module found,compilation aborted!Command /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift Failed with exit code 1总结
以上是内存溢出为你收集整理的匿名类在swift全部内容,希望文章能够帮你解决匿名类在swift所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)