ACCP7.0S2深入.net和c#第6章上机练习

本文详细介绍了ACCP7.0S2课程中关于.NET和C#的第六章上机实践内容,包括上机1、2、3及4的练习环节,旨在提升学员的编程技能和理解。
摘要由CSDN通过智能技术生成

--上机1

public class person
    {
      public string name{get;set;}
      public int age { get; set; }
       public person(){}
       public person(string name,int age) {
           this.name = name;
           this.age = age;
       }
    }

public class student:person
    {
       public int no { get; set; }
       public student() { }
       public student(string name, int age, int no){
           base.name = name;
           base.age = age;
           this.no = no;
       }
    }

public class truck:vehicle
    {
       public truck(string type,string pro):base(type,pro) {
           base.type = type;
           base.produce = pro;
       }
       public void truckrun() {
           Console.WriteLine("型号为{0},产地为{1}的卡车在行驶",base.type,base.produce);
       }
    }

public class vehicle
    {
       public string type;
       public string produce;
       public vehicle(string type,string pro) {
           this.type = type;
           this.produce = pro;
       }
       public void vehiclerun() {
           Console.WriteLine("汽车在行驶");
       }
    }

class Program
    {
        static void Main(string[] args)
        {
            truck t = new truck("奔驰
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值