Guest User

Untitled

a guest
Nov 15th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. void main()
  2. {
  3. import std.experimental.allocator;
  4. import std.stdio : write, writeln, writef, writefln;
  5.  
  6. class Foo
  7. {
  8. public int id = 42;
  9. public double f = 4.2;
  10. public this()
  11. {
  12. }
  13.  
  14. public this(int id)
  15. {
  16. this.id = id;
  17. }
  18. }
  19.  
  20. Foo foo = theAllocator.make!Foo();
  21.  
  22. writeln(foo.id);
  23.  
  24. foo = theAllocator.make!Foo(5);
  25.  
  26. writeln(foo.id);
  27. }
Add Comment
Please, Sign In to add comment