static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            //创建大学
            OrganizationComponent university = new University("布鲁弗莱大学", "学挖掘机,到布鲁佛莱!");

            //创建学院
            OrganizationComponent computerCollege = new College("计算机学院", "这是计算机学院的简介");

            university.Add(computerCollege);
            OrganizationComponent infoEngineerCollege = new College("信息工程学院", "这是信息工程学院的简介");

            university.Add(infoEngineerCollege);

            //创建专业(系)
            OrganizationComponent department1 = new Department("计算机科学与技术系", "这是计算机科学与技术系的简介");
            OrganizationComponent department2 = new Department("软件工程系", "这是软件工程系的简介");

            computerCollege.Add(department1);
            computerCollege.Add(department2);
            OrganizationComponent departmentA = new Department("通信工程系", "这是通信工程系的简介");
            OrganizationComponent departmentB = new Department("信息工程系", "这是信息工程系的简介");

            infoEngineerCollege.Add(departmentA);
            infoEngineerCollege.Add(departmentB);


            university.Print();
            //computerCollege.Print();
            //department1.Print();

            Console.ReadLine();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            //从大到小创建
            University university = new University("南昌大学", "中国一般的大学");

            College college1 = new College("资源环境与化学工程学院", "");
            College college2 = new College("计算机工程学院", "");

            college1.Add(new Department("环境工程", "很垃圾"));
            college1.Add(new Department("环境科学", "也很垃圾"));

            college2.Add(new Department("软件工程", "还不错"));
            college2.Add(new Department("网络工程", "也还行"));

            university.Add(college1);
            university.Add(college2);

            college2.Print();
            university.Print();


            Console.ReadLine();
        }