【C#菜鸟】关于对象的一些问题

图片说明

问题如下:

为什么在对象初始化时(在前面已经声明过对象,在后面初始化时又再次声明了),会出现如下图所示的错误提示。
图片说明

下面为具体代码:

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 使用对象20160730
{
public partial class Form1 : Form
{
Guy joe;
Guy bob;
int bank = 100;

    public void UpdateForm()
    {
        joesCashLabel.Text=joe.Name+"has $ "+joe.Cash;
        bobCashLabel.Text = bob.Name + "has $ " + bob.Cash;
        bankCashLabel.Text = "The bank has $ " + bank;
    }

    public Form1()
    {
        InitializeComponent();

        Guy joe = new Guy();
        Guy bob = new Guy();
        joe.Name="Joe";
        joe.Cash=100;
        bob.Name="Bob";
        bob.Cash=50;

        UpdateForm();
    }

    private void Form1_Load(object sender, EventArgs e)
    {

    }

    private void button1_Click(object sender, EventArgs e)
    {
        if (bank >= 10)
        {
            bank -= joe.ReceiveCash(10);
            UpdateForm();

        }
        else
        {
            MessageBox.Show("The bank is out of money.");

        }
    }

    private void button2_Click(object sender, EventArgs e)
    {

        bank += bob.GiveCash(5);
        UpdateForm();

    }
}

}

Guy joe = new Guy();
Guy bob = new Guy();
->
joe = new Guy();
bob = new Guy();

否则你访问的是局部变量job bob而不是成员变量job bob