static void Main(string[] args) { var myBike = new Zero(); myBike.MainColor = "Black"; myBike.MaxOccupancy = 2; myBike.Name = "Zero"; var myTesla = new Tesla(); myTesla.MainColor = "Space Gray"; myTesla.MaxOccupancy = 6; myTesla.Name = "Tesla"; var myCessna = new Cessna(); myCessna.MainColor = "Wine Berry Over Gold"; myCessna.MaxOccupancy = 4; myCessna.Name = "Cessna"; var myRam = new Ram(); myRam.MainColor = "Majestic Blue"; myRam.MaxOccupancy = 8; myRam.Name = "Ram"; myBike.Stop(); myBike.Turn(); myBike.Drive(); myTesla.Stop(); myTesla.Turn(); myTesla.Drive(); myCessna.Stop(); myCessna.Turn(); myCessna.Drive(); myRam.Stop(); myRam.Turn(); myRam.Drive(); Console.WriteLine(myTesla); double price = 15.00; Console.WriteLine(price.ToString("C")); }
static void Main(string[] args) { var myBike = new Zero(); // I can still reference the inherited property myBike.MainColor = "Black"; myBike.MaxOccupancy = 2; myBike.Name = "Zero"; myBike.Drive(); myBike.Turn(); myBike.Stop(); Console.WriteLine("-----------------"); var myTesla = new Tesla(); myTesla.MainColor = "midnight silver"; myTesla.MaxOccupancy = 6; myTesla.Name = "Tesla"; myTesla.Drive(); myTesla.Turn(); myTesla.Stop(); Console.WriteLine("-----------------"); var myCessna = new Cessna(); myCessna.MainColor = "blue"; myCessna.MaxOccupancy = 4; myCessna.Name = "Cessna"; myCessna.Drive(); myCessna.Turn(); myCessna.Stop(); Console.WriteLine("-----------------"); var myRam = new Ram(); myRam.MainColor = "purple"; myRam.MaxOccupancy = 4; myRam.Name = "Ram"; myRam.Drive(); myRam.Turn(); myRam.Stop(); Console.WriteLine("-----------------"); }
static void Main(string[] args) { var myBike = new Zero(); myBike.MainColor = "Black"; myBike.MaxOccupancy = 2; myBike.BatteryKWh = 10; myBike.Name = "Zero Bike"; var myRoboTruck = new Tesla(); myRoboTruck.MainColor = "Midnight Silver"; myRoboTruck.MaxOccupancy = 6; myRoboTruck.Name = "Tesla Robotruck"; var myPlane = new Cessna(); myPlane.MainColor = "White"; myPlane.MaxOccupancy = 4; myPlane.Name = "Cessna Plane"; var myWorkTruck = new Ram(); myWorkTruck.MainColor = "Dirt Brown"; myWorkTruck.Name = "Ram Truck"; myWorkTruck.Drive(); myBike.Drive(); myRoboTruck.Drive(); myPlane.Drive(); myWorkTruck.Turn(); myBike.Turn(); myRoboTruck.Turn(); myPlane.Turn(); myWorkTruck.Stop(); myBike.Stop(); myRoboTruck.Stop(); myPlane.Stop(); }
static void Main(string[] args) { var myBike = new Zero(); // I can still reference the inherited property myBike.MainColor = "Black"; myBike.MaxOccupancy = 2; var myTesla = new Tesla(); myTesla.MainColor = "Midnight Silver"; myTesla.MaxOccupancy = 6; var myRam = new Ram(); myRam.MainColor = "Green"; myRam.MaxOccupancy = 5; var myCessna = new Cessna(); myCessna.MainColor = "Silver"; myBike.Drive(); myBike.Turn("right"); myBike.Stop(); myTesla.Drive(); myTesla.Turn("left"); myTesla.Stop(); myCessna.Drive(); myCessna.Turn("right"); myCessna.Stop(); myRam.Drive(); myRam.Turn("left"); myRam.Stop(); // double price = 15.50; // Console.WriteLine (price.ToString ("C")); }