本文整理汇总了C#中Car.brake方法的典型用法代码示例。如果您正苦于以下问题:C# Car.brake方法的具体用法?C# Car.brake怎么用?C# Car.brake使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Car
的用法示例。
在下文中一共展示了Car.brake方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: run
static void run()
{
Vehicle vehicle;
//Vehicule is an abstract class
//vehicule = new Vehicule("diesel",150);
//vehicule = new Vehicule();
//by inheritance, vehicule gets public behaviours of its mother class
//Console.WriteLine(vehicule.ToString());
//vehicule.start();
Plane plane = new Plane("kerosene",540,8000);
plane.Speed = 540;
plane.Fuel = "Kerosene";
plane.start();
plane.climb();
plane.descend();
plane.accelerate();
plane.brake();
Car car = new Car("diesel", 196, 120);
car.start();
car.drive();
car.accelerate();
car.brake();
vehicle = car; //after that, only public members of the vehicle class can be accessed . we lose accessibility to car members
vehicle.start(); //if start has redefinition in child classes so child method will be called too
((Car)vehicle).drive(); // restore the view of the object through a car
//always test the type before value cast 'conversion)
if (vehicle is Plane)
{
((Plane)vehicle).climb();
Plane p = (Plane)vehicle;
p.climb();
Plane p2 = vehicle as Plane;
p2.climb();
}
Vehicle[] vehicles = new Vehicle[10];
vehicles[0] = car;
vehicles[1] = plane;
Car[] cars = new Car[10];
cars[0] = new Car("diesel", 196, 120);
cars[0].Quotation = 150;
cars[0].Quotation = 100;
cars[0].isRising();
cars[1] = new Car("diesel", 196, 90);
cars[2] = new Car("diesel", 196, 20);
cars[3] = new Car("super", 196, 250);
cars[4] = new Car("nitro", 196, 1000);
cars[5] = new Car("diesel", 196, 154);
cars[6] = new Car("super", 196, 157);
ICotable[] cotables = new ICotable[3];
cotables[0] = new Artwork();
cotables[0].Quotation = 150000;
cotables[0].Quotation = 145000;
cotables[1] = cars[0];
int[] integers = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 5, 4, 8, 6, 3, 9, 7 };
Array.Sort(integers);
foreach (int i in integers)
Debug.WriteLine(i);
Array.Sort(cars);
}