using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ch6_5
{
    public partial class Form1 : Form
    {
        int x = 1; //instance variable or field
        public void firstMethod()
        {
            label1.Text = " In firstMethod :\n";
            int x = 25;
            label1 .Text += " Local x  : " + x.ToString ();
            x++;
            label1.Text += "\n Add 1 to local x : " + x.ToString();
            label1.Text += "\n Refer to field x : " + (this.x).ToString();
        }
        //*******************
        public void secondMethod()
        {
            label1.Text += "\n In secondMethod : ";
            label1.Text += "\n Instance variable x : " + x.ToString();
            x += 5; // add to field x
            label1.Text += "\n Add 5 to instance variable x : " + x.ToString();
        }
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            firstMethod();
            secondMethod();
        }
    }
}
