Esempio n. 1
0
        //Main_7_2_1
        static void Main(string[] args)
        {
            //��ʹ��new�����ɽṹ�����ڲ���Ա����ʼ��Ϊ0
            Family newFamily;
            newFamily.name = "Anytao Family";
            newFamily.sex = true;
            Console.WriteLine(newFamily.name);

            //��new�����ɽṹ�����ô�����������
            Family myFamily = new Family("Anytao Family", 26, true, "China", new Person("Anytao", 26));

            Person person = new Person();
            person.Name = "Anytao";

            //��ֵ���ݲ���
            ShowFamily(myFamily);
            //�����ô��ݲ���
            ShowPerson(person);

            Console.WriteLine("***************************");
            Console.WriteLine("I'm {0}", myFamily.name);
            Console.WriteLine("I'm {0}", person.Name);
            myFamily.GetSex();
            myFamily.ShowPerson();
            Console.WriteLine("***************************");
            Console.WriteLine(myFamily.ToString());
        }
Esempio n. 2
0
 public static void ShowFamily(Family family)
 {
     family.name = "Aeor";
     Console.WriteLine("This is {0}", family.name);
 }