Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import std.stdio;
- template addFunc(T) {
- T add(T x, T y)
- {
- return x + y;
- }
- T times(T x, T y)
- {
- return x * y;
- }
- T minus(T x, T y)
- {
- return x - y;
- }
- }
- void main()
- {
- writeln(addFunc!int.add(5, 5));
- writeln(addFunc!int.times(2, 4));
- writeln(addFunc!int.minus(3, 5));
- writef("Hello, World!\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement