root/trunk/src/tutorials/examples/opCall/opCall.d

Revision 6, 449 bytes (checked in by jcc7, 3 years ago)

Made more progress in developing convertToWiki and added some files.

Line 
1 import std.string;
2
3 class A
4 {
5     this(uint x)
6     {
7         num = x;
8     }
9    
10     char[] toString()
11     {
12         return std.string.toString(/+this.num+/ num);
13     }
14    
15     private uint num;
16    
17    
18    
19     static A opCall(uint x)
20     {
21         return new A(x);
22     }
23 }
24
25 void main()
26 {
27     //and you can create class objects the in a c++ syntax
28     A a = A(500);
29    
30     printf("Number: %u\n", a.toString());
31 }
Note: See TracBrowser for help on using the browser.