Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1.  
  2. import std.stdio;
  3.  
  4. mixin template Foo(string text) {
  5.  
  6. void bar(string name) {
  7. writeln(text ~ " " ~ name);
  8. }
  9.  
  10. }
  11.  
  12. class Bat {
  13.  
  14. mixin Foo!("Hello");
  15.  
  16. }
  17.  
  18. void main(string[] args) {
  19. auto bat = new Bat;
  20. bat.bar("there."); // Hello there.
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement