10.类的构造(1)

1.  默认情况下,int为“0”;string为空;

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

 

        private void Form1_Load(object sender, EventArgs e)
        {
            Test test = new Test();
            MessageBox.Show(test.i+"");
            MessageBox.Show(test.s);
        }
     }
    class Test
    {
        public int i;
        public string s;
    }

2.  (显示的内容以代码为准)

3.(显示的内容以代码为准)接上)

 

 

posted @ 2010-03-06 21:42  平凡人生  阅读(153)  评论(0编辑  收藏  举报