1 module user; 2 3 import witchcraft; 4 5 6 interface IUser : ClassAccessor { 7 string getName(); 8 } 9 10 abstract class AbstractUser(T) : IUser { 11 mixin Witchcraft; 12 abstract string getName(); 13 } 14 15 @Annotation @Table("nothing") 16 @("string") 17 class User : AbstractUser!(int) { 18 mixin Witchcraft; 19 20 string username; 21 string password; 22 int age; 23 24 private string male; 25 26 this() { 27 username = "noname"; 28 password = "123456"; 29 age = 20; 30 } 31 32 this(string username, string password) { 33 this.username = username; 34 this.password = password; 35 } 36 37 38 void setUser(string name, int age) { 39 this.username = name; 40 this.age = age; 41 } 42 43 void setUser(string name, string password) { 44 this.username = name; 45 this.password = password; 46 } 47 48 49 void setUserName(string name) { 50 this.username = name; 51 } 52 53 override string getName() { 54 return username; 55 } 56 57 int getAge() { 58 return age; 59 } 60 61 void setAge(int age) { 62 this.age = age; 63 } 64 65 private void testPrivateMethod() { 66 67 } 68 69 static void testStaticMethod() { 70 71 } 72 } 73 74 interface Annotation { 75 } 76 77 struct Table { 78 string name; 79 }