WindowsFormsApp1/person.cs

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WindowsFormsApp1
{


    //接口实现多态
    //实现eat,work接口
    public class Person : eat, work
    {
        public string name;
        public int age;

        public Person() 
        {
            name = "yd";
            age = 18;
        }
        public void eat()
        {
            Console.WriteLine("人在吃饭");
        }

        void eat.sleep()
        {
            Console.WriteLine("人在梦中吃饭");
        }

        void work.sleep()
        {
            Console.WriteLine("人在梦中工作");
        }

        public void work()
        {
            Console.WriteLine("人在工作");
        }

        public virtual void put()
        {
            System.Console.WriteLine("姓名:{0},年龄:{1}", this.name, this.age);
        }
    }
    //实现eat接口
    public class Cat : eat
    {
        public void eat()
        {
            Console.WriteLine("猫在吃饭");
        }

        public void sleep()
        {
            Console.WriteLine("猫在梦中吃饭");
        }
    }
后面还有 27 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。