Created
August 31, 2010 22:58
-
-
Save od0x0/559931 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
Vec3: class{ | |
x, y, z: Float | |
allocWith: static func(allocator: Func(SizeT)->Pointer) -> This{ | |
object := allocator(Vec3 as Class instanceSize) as This | |
if(object) object class = This | |
return object | |
} | |
init: func(=x,=y,=z) -> This { this } | |
print: func -> This { "Vec3(x: %f, y: %f, z: %f)" format(x,y,z) println(); this } | |
} | |
malloc: extern func(SizeT) -> Pointer | |
free(Vec3 allocWith(malloc) init(1.0,2.0,3.0) print()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment