[急,在线等]一个关于构造函数传参的问题
using System;
class Vehicle
{
public int wheels;
protected float weight;
public Vehicle(){;}
public Vehicle(int w,float g){
wheels = w;
weight = g;
}
public void Show(){
Console.WriteLine( "the wheel of vehicle is :{0} ",wheels);
Console.WriteLine( "the wheel of vehicle is :{0} ",wheels);
}
};
class train
{
public int num;
private int passengers;
private float weight;
public Train(){;}
public Train(int n,int p,float w){
num = n;
passengers = p;
weight = w;
}
public void Show(){
Console.WriteLine( "the num of train is :{0} ",num);
Console.WriteLine( "the weight of train is:{0} ",weight);
Console.WriteLine( "the passengers train car is:{0} ",passengers);
}
}
class Car:Vehicle
{
int passengers;
public Car(int w,float g,int p):base(w,g)
{
wheels = w;
weight = g;
passengers = p;
}
new public void Show()
{
Console.WriteLine( "the wheel of car is:{0} ",wheels);
Console.WriteLine( "the weight of car is:{0} ",weight);
Console.WriteLine( "the Passengers of car is:{0} ",passengers);
}
}
class Test
{
public static void Main()