主题:C#初学者一个小问题
using System;
using System.Collections.Generic;
using System.Text;
namespace MYfirstprogram
{
class Program
{
static void Main(string[] args)
{
stuby A1 = new stuby();
stuby A2 = A1;
A2.x = 15;
int B1 = 30;
int B2 = B1;
Console.WriteLine("A1.x=" + A1.x + ",A2.x=" + A2.x);
Console.WriteLine("B1=" + B1 + ",B2=" + B2);
}
class stuby
{
public int x = 10;
}
}
}
这个程序中"变量.变量"是什么意思,也就是A1.X是什么意思,怎么值都没有变?
谢谢哪位大哥告诉我
using System.Collections.Generic;
using System.Text;
namespace MYfirstprogram
{
class Program
{
static void Main(string[] args)
{
stuby A1 = new stuby();
stuby A2 = A1;
A2.x = 15;
int B1 = 30;
int B2 = B1;
Console.WriteLine("A1.x=" + A1.x + ",A2.x=" + A2.x);
Console.WriteLine("B1=" + B1 + ",B2=" + B2);
}
class stuby
{
public int x = 10;
}
}
}
这个程序中"变量.变量"是什么意思,也就是A1.X是什么意思,怎么值都没有变?
谢谢哪位大哥告诉我