using System;
namespace C7_4
{
public class Vehicle
{
protected int wheels; //輪子個數
protected float weight; //重量
public void SetWheels(int newwheels)
{
wheels = newwheels;
}
public int GetWheels()
{
return wheels;
}
public void SetWeight(float newweight)
{
weight = newweight;
}
public float GetWeight()
{
return weight;
}
}
public class Program
{
public static void Main()
{
Vehicle v = new Vehicle();
Console.WriteLine("輪子個數為:{0}重量為:{1}", v.GetWheels(), v.GetWeight());
}
}
}
沒有留言:
張貼留言