Advertisement
Guest User

Untitled

a guest
Jul 4th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 0.34 KB | None | 0 0
  1. import std.stdio;
  2.  
  3. template addFunc(T) {
  4.     T add(T x, T y)
  5.     {
  6.         return x + y;
  7.     }
  8.  
  9.     T times(T x, T y)
  10.     {
  11.         return x * y;
  12.     }
  13.  
  14.     T minus(T x, T y)
  15.     {
  16.         return x - y;
  17.     }
  18.  
  19. }
  20.  
  21. void main()
  22. {
  23.  
  24.     writeln(addFunc!int.add(5, 5));
  25.     writeln(addFunc!int.times(2, 4));
  26.     writeln(addFunc!int.minus(3, 5));
  27.     writef("Hello, World!\n");
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement