private void button16_Click(object sender, EventArgs e) { ClsBanking rr = new ClsBanking(); //屬性多載 索引子 MessageBox.Show(rr[1].ToString()); MessageBox.Show(rr["1"].ToString()); }
private void button12_Click(object sender, EventArgs e) { //可以給予不同存取規則 ClsBanking user1 = new ClsBanking(); MessageBox.Show(user1.P4.ToString()); //無法set user1.P4=99; }
private void button22_Click(object sender, EventArgs e) { ClsBanking user = new ClsBanking();//建構子 MessageBox.Show(user._balance.ToString()); ClsBanking user2 = new ClsBanking(1000);//建構子 MessageBox.Show(user._balance.ToString()); }
private void button18_Click(object sender, EventArgs e) { ClsBanking user = new ClsBanking(); user.Disposed();//...... //using (ClsBanking user2 = new ClsBanking())//interface //{ //} }
private void button10_Click(object sender, EventArgs e) { ClsBanking user1 = new ClsBanking(); MessageBox.Show(user1[0].ToString()); try { MessageBox.Show(user1[10].ToString()); } catch (IndexOutOfRangeException EX) { MessageBox.Show(EX.Message); } catch (Exception Ex) { MessageBox.Show(Ex.Message); } }
private void button1_Click(object sender, EventArgs e) { user1 = new ClsBanking(); MessageBox.Show(user1.balance.ToString("C2")); }
private void button21_Click(object sender, EventArgs e) { ClsBanking user = new ClsBanking(); user = null; }