码迷,mamicode.com
首页 > 其他好文 > 详细

Person

时间:2016-08-31 15:47:58      阅读:106      评论:0      收藏:0      [点我收藏+]

标签:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PersonDemo2
{
    /// <summary>
    /// 性别
    /// </summary>
    public enum Gender
    {
        Female,Man
    }

   public class Person
   {
       #region 
       protected string name;
       private Gender gender;
       private string hobby;
       protected int age;
       #endregion

       public Person()
       {
       }

       public string Name
       {
           get { return name; }
           set { name = value; }
       }
       public Gender Gender
       {
           get { return gender; }
           set { gender = value; }
       }
       public string Hobby
       {
           get { return hobby; }
           set { hobby = value; }
       }

       public virtual void Speak(string msg)
       {
           Console.WriteLine(name+"说"+msg);
       }

       public void ShowInfo()
       {
           Console.WriteLine("{0} {1} {2} {3}",name,gender,hobby,age);
       }

       public virtual void Study()
       {
           Console.WriteLine("so bad!");
       }
   }
}

Person

标签:

原文地址:http://www.cnblogs.com/ken-admin/p/5825982.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!