示例#1
0
        /*public int GetId()
         * {
         *  return this.id;
         * }
         *
         * public void SetId(int id)
         * {
         *  this.id = id;
         * }
         * public string GetName()
         * {
         *  return this.name;
         * }
         *
         * public void SetName(string name)
         * {
         *  this.name = name;
         * }
         * public double GetCgpa()
         * {
         *  return this.cgpa;
         * }
         *
         * public void SetCgpa(double cgpa)
         * {
         *  this.cgpa = cgpa;
         * }
         *
         * public OurDateType GetDateOfBirth()
         * {
         *  return this.dateOfBirth;
         * }
         *
         * public void SetDateOfBirth(OurDateType dateOfBirth)
         * {
         *  this.dateOfBirth = dateOfBirth;
         * }*/

        public Student(int id, string name, double cgpa, OurDateType dateOfBirth)
        {
            this.Id          = id;          //this.SetId(id);
            this.Name        = name;        //this.SetName(name);
            this.Cgpa        = cgpa;        //this.SetCgpa(cgpa);
            this.DateOfBirth = dateOfBirth; //this.SetDateOfBirth(dateOfBirth);
        }
示例#2
0
        static void Main(string[] args)
        {
            OurDateType date1 = new OurDateType(10, "March", 2000);
            Student     s     = new Student(100, "Bruce", 3.25, date1);

            s.Id = 1000;//s.id = 1000;//s.SetId(1000);
            //Console.WriteLine("{0}", s.Id);
            s.Name        = "Clerk";
            s.Cgpa        = 2.87;
            s.DateOfBirth = date1;

            s.ShowInformation();
        }