D语言rang编程示例代码

代码语言:d

所属分类:其他

代码描述:D语言rang编程示例代码

代码标签: 编程 示例

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

import std.stdio; 
import std.string; 
 
struct Student { 
   string name; 
   int number; 
   
   string toString() const { 
      return format("%s(%s)", name, number); 
   } 
}
  
struct School { 
   Student[] students; 
}
struct StudentRange {
   Student[] students; 
   
   this(School school) { 
      this.students = school.students; 
   } 
   @property bool empty() const { 
      return students.length == 0; 
   } 
   @property ref .........完整代码请登录后点击上方下载按钮下载查看

网友评论0