关于C#的问题 直接把错误纠正吧。。

来源:百度知道 编辑:UC知道 时间:2024/06/04 06:51:30
using System;
class Count
{
static int count;
int number;
public Count (){
count = count + 1;
number = count;
}
public void show()
{
Console.WriteLine("object={0}:count={1}", number, count);
}

class Test {
public static void Main();{
Count a=new Count ();
a.show;
Console.writeline();
Count b=new Count();
a.show;
b.show;
Console.writeline();
Count c=new Count();
a.show();
b.show();
c.show();

}}
问题问错了 。。。只这个

using System;
class Count
{
static int count;
int number;
public Count (){
count = count + 1;
number = count;
}
public void show()
{
Console.WriteLine("object={0}:count={1}", number, count);

using System;
class Count
{
static int count;
int number;

public Count (){
count = count + 1;
number = count;
}
public void show()
{
Console.WriteLine("object={0}:count={1}", number, count);
}
}

class Test {
public static void Main()
{
Count a=new Count ();
a.show();
Console.writeline();
Count b=new Count();
a.show();
b.show();
Console.writeline();
Count c=new Count();
a.show();
b.show();
c.show();
}
}