出现错误 不包含适合于入口点的静态“Main” 方法

[复制链接]
查看11 | 回复3 | 2011-8-5 17:21:50 | 显示全部楼层 |阅读模式
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace l1
{

using System;

public class MotorVehicle

{

public string make;

public string model;

public MotorVehicle(string make, string model)

{

Console.WriteLine("In MotorVehicle constructor");

this.make = make;

this.model = model;

Console.WriteLine("this.make= " + this.make);

Console.WriteLine("this.model=" + this.model);

}

public void DisplayModel()

{

Console.WriteLine("In MotorVehicle DisplayModel Method");

Console.WriteLine("model=" + model);

}

}

public class Car : MotorVehicle

{

public new string model;

public Car(string make, string model) :

base(make, "Test")

{

Console.WriteLine("In Car Constructor");

this.model = model;

Console.WriteLine("this.model=" + this.model);

}

public new void DisplayModel()

{

Console.WriteLine("In Car DisplayModel Method");

Console.WriteLine("model=" + model);

base.DisplayModel();

}

}

class Example7_4

{

public static void main()

{

Console.WriteLine("Createing a car object");

Car myCar = new Car("Toyota", "MR2");

Console.WriteLine("Back in Main() method");

Console.WriteLine("myCar.make=" + myCar.make);

Console.WriteLine("myCar.model=" + myCar.model);

Console.WriteLine("Calling myCar.DisplayModel()");

myCar.DisplayModel();

char myChar = (char)System.Console.Read();

}

}
}

回复

使用道具 举报

千问 | 2011-8-5 17:21:50 | 显示全部楼层
楼主大悲剧啊!大小写。static void Main(string[] args)...
回复

使用道具 举报

千问 | 2011-8-5 17:21:50 | 显示全部楼层
把你的public static void main()中的main()改成Main()...
回复

使用道具 举报

千问 | 2011-8-5 17:21:50 | 显示全部楼层
杯具的楼主:public static void Main()...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行