zoukankan      html  css  js  c++  java
  • 第六章,上机练习1(汽车)


    汽车管理

    1
    using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 7 namespace No._6 8 { 9 class Program 10 { 11 /// <summary> 12 /// 测试类Main()方法 13 /// </summary> 14 static void Main(string[] args) 15 { 16 Truck truck = new Truck("奥迪A6", "德国"); 17 18 truck.TruckRun(); 19 } 20 } 21 }
     1 using System;
     2 using System.Collections.Generic;
     3 using System.Linq;
     4 using System.Text;
     5 using System.Threading.Tasks;
     6 
     7 namespace No._6
     8 {
     9     public class Truck:Vehicle
    10     {
    11         /// <summary>
    12         /// 结构函数
    13         /// </summary>
    14         /// <param name="Type"></param>
    15         /// <param name="Place"></param>
    16         public Truck(string Type, string Place):base(Type,Place)
    17         {
    18 
    19         }
    20         /// <summary>
    21         /// 输出方法
    22         /// </summary>
    23         public void TruckRun() 
    24         {
    25             Console.WriteLine("型号为"+this.Type+",产地为"+this.Place+"的卡车在行驶!");
    26         }
    27     }
    28 }
     1 using System;
     2 using System.Collections.Generic;
     3 using System.Linq;
     4 using System.Text;
     5 using System.Threading.Tasks;
     6 
     7 namespace No._6
     8 {
     9     /// <summary>
    10     /// 汽车类
    11     /// </summary>
    12     public class Vehicle
    13     {
    14         //型号
    15         public string  Type { get; set; }
    16         //产地
    17         public string Place { get; set; }
    18         //构造函数
    19         public Vehicle(string type,string place) 
    20         {
    21             this.Type = type;
    22             this.Place = place;
    23         }
    24     }
    25 }
  • 相关阅读:
    BZOJ1568:[JSOI2008]Blue Mary开公司
    HDU4348:To the moon
    洛谷【P3437】[POI2006]TET-Tetris 3D
    AtCoder Regular Contest 072 E:Alice in linear land
    AtCoder Grand Contest 014 D:Black and White Tree
    洛谷【P2664】树上游戏
    浅谈树分治
    BZOJ3784:树上的路径
    BZOJ2006:[NOI2010]超级钢琴
    BZOJ3648:寝室管理
  • 原文地址:https://www.cnblogs.com/yjjh/p/6691732.html
Copyright © 2011-2022 走看看