public static void Main()
        {
            Student stu = new Student()
            {
                Name = "test1", Age = 22
            };

            stu.SayHello();
        }
Пример #2
0
        static void Main(string[] args)
        {
            //定义一个学生类,分别有姓名,性别,年龄,语文,数学,英语成绩
            //Class1 myPerson = new Class1();
            //myPerson._name = "屎忽鬼";
            //myPerson._age = 109;
            //myPerson._gender = "屎忽鬼";

            //myPerson.CHLSS();
            //Console.ReadKey();

            Student zsStudent = new Student("张三", "男", 24, 96, 90, 99);

            zsStudent.SayHello();

            Student xhStudent = new Student("小红", "不男不女", 30, 96, 90, 99);

            xhStudent.SayHello();
            Console.ReadKey();
        }
Пример #3
0
        static void Main()
        {
            Student student1 = new Student()
            {
                Name = "Pesho", Age = 19
            };

            student1.Age++;

            Console.WriteLine(student1.Name, student1.Age);

            student1.SayHello();

            Student[] students = new Student[2]
            {
                new Student("Pesho", 19),
                new Student("Gosho", 23)
            };

            foreach (Student student in students)
            {
                Console.WriteLine();
            }
        }