Created
July 3, 2014 08:05
-
-
Save xlc/ba7f213e1f94cc1cada5 to your computer and use it in GitHub Desktop.
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 Cocoa | |
class A : NSObject { | |
init() { } | |
} | |
class B : A { | |
} | |
class C : A { | |
} | |
func Create<T:NSObject> () -> T { | |
return T() | |
} | |
println(Create() as A) // <_TtC11lldb_expr_01A: 0x7fa1b0e1b030> | |
println(Create() as B) // <_TtC11lldb_expr_01B: 0x7fa1b0e203d0> | |
println(Create() as C) // <_TtC11lldb_expr_01C: 0x7fa1b0e1b630> | |
class D { | |
init() { } | |
} | |
class E : D { | |
} | |
class F : D { | |
} | |
func Create2<T:D> () -> T { | |
return T() | |
} | |
println(Create2() as D) // C11lldb_expr_01D (has 0 children) | |
println(Create2() as E) // C11lldb_expr_01D (has 0 children) | |
println(Create2() as F) // C11lldb_expr_01D (has 0 children) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment