static void Main(string[] args) { Vehicle vehicle1 = new Vehicle(); vehicle1.Name = "kone"; vehicle1.Speed = 100; vehicle1.PrintData(); Console.WriteLine(vehicle1.ToString()); }
static void Main(string[] args) { Vehicle vehicle = new Vehicle(); vehicle.Name = "Auto"; vehicle.Speed = 100; vehicle.Tyres = 4; vehicle.PrintData(); Console.WriteLine(vehicle.ToString()); Console.ReadLine(); }
static void Main(string[] args) { // Create vehicle object Vehicle car = new Vehicle(); car.Model = "Dacia Sandero"; car.Speed = 160; car.Tyres = 4; car.PrintData(); Console.WriteLine(car.ToString()); // ToString method }
static void Main(string[] args) { // Create vehicle Vehicle audi = new Vehicle("Audi"); audi.Speed = 150; audi.Tyres = 4; audi.PrintData(); Console.ReadLine(); // ToString Console.WriteLine(audi); Console.ReadLine(); }
static void Main(string[] args) { Vehicle vehicle = new Vehicle(); //default constructor vehicle.PrintData(); vehicle.Speed = 60; vehicle.Name = "Vehicle 1"; vehicle.Tyres = 4; vehicle.PrintData(); vehicle.ToString(); Console.WriteLine(vehicle); Vehicle vehicle2 = new Vehicle(100, 4); //parametric constructor vehicle2.PrintData(); vehicle2.Name = "Vehicle 2"; vehicle2.Speed += 10; vehicle2.PrintData(); }
static void Main(string[] args) { // create a new vehicle object Vehicle motorbike = new Vehicle(); motorbike.PrintData(); Console.WriteLine(); motorbike.Name = "Harley Davidson"; motorbike.Speed = 125; motorbike.Tyres = 18; Console.WriteLine(motorbike.ToString()); Console.WriteLine(); motorbike.Name = "Suzuki GSX"; motorbike.Speed = 170; motorbike.Tyres = 20; motorbike.PrintData(); Console.WriteLine(); motorbike.Name = "Honda CBR"; motorbike.Speed = 165; motorbike.Tyres = 20; Console.WriteLine(motorbike.ToString()); Console.WriteLine(); motorbike.Name = "Kawasaki GPZ"; motorbike.Speed = 140; motorbike.Tyres = 18; motorbike.PrintData(); Console.WriteLine(); Console.ReadLine(); }