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 }
  • 相关阅读:
    asm
    chrome-vimium在markdown插件的页面失去效果
    chrome-如何给simple world highlighter添加开关
    调整Chrome中文字体为雅黑
    最新版本的Chrome浏览器如何设置网页编码?
    访问sharepoint站点自动使用当前用户名和密码登录
    请停用以开发者模式运行的扩展
    ARM Instruction Set
    阿里前端面试
    原型链
  • 原文地址:https://www.cnblogs.com/yjjh/p/6691732.html
Copyright © 2011-2022 走看看