示例#1
0
 static void Main(string[] args)
 {
     Vehicle vehicle1 = new Vehicle();
     vehicle1.Name = "kone";
     vehicle1.Speed = 100;
     vehicle1.PrintData();
     Console.WriteLine(vehicle1.ToString());
 }
示例#2
0
        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();
        }
示例#3
0
文件: Program.cs 项目: K1801/Demo03
        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
        }
示例#4
0
        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();

        }
示例#5
0
        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();
        }
示例#6
0
文件: Program.cs 项目: temesky/demo03
        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();

        }