结构体嵌套举例:

 1 namespace structstudent
 2 {    class Program
 3     {        struct student
 4         {  public string name;
 5            public uint age;
 6            public char sex;
 7            public struct department
 8             {
 9                 public string DepartmentName;
10                 public string DepartmentTel;
11             }
12 }
13         static void Main(string[] args)
14         {   student stu1;
15             student.department  d1;  //嵌套
16             stu1.name="John";
17             d1. DepartmentName ="computer";
18         }   
19 
20     }
21 }

 

 

posted on 2013-11-12 11:46  fjfhxotfl  阅读(337)  评论(0编辑  收藏  举报