C#--核心

news2025/2/27 10:28:27

CSharp核心知识点学习

学习内容有:

绪论:面向对象的概念

Lesson1:类和对象

练习:

Lesson2:封装--成员变量和访问修饰符

练习:

Lesson3:封装--成员方法

Lesson4:封装--构造函数和析构函数

知识点四 垃圾回收机制--面试常考

练习:

Lesson5:成员属性

练习:

Lesson6:封装--索引器

练习:

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

namespace Lesson6_练习
{

    #region 练习
    //自定义一个整形数组类,该类中有一个整形数组变量
    //为它封装增删查改的方法

    class IntArray
    {
        private int[] array;
        //房间容量
        private int capacity;
        //当前放了几个房间
        private int length;

        public IntArray()
        {
            capacity = 5;
            length = 0;
            array = new int[capacity];
        }

        //增
        public void Add(int value)
        {
            //如果要增加就涉及扩容
            //扩容就涉及"搬家"
            if(length < capacity)
            {
                array[length] = value;
                ++length;
            }
            //扩容“搬家”
            else
            {
                capacity *= 2;
                //新房子
                int[] tempArray = new int[capacity];
                for (int i = 0; i < array.Length; i++)
                {
                    tempArray[i] = array[i];
                }
                //老的房子地址 指向新房子地址
                array = tempArray;

                //传入的往后放
                array[length] = value;
                ++length;
            }
        }

        //删
        //指定内容删除
        public void Remove(int value)
        {
            //找到 传入值 在哪个位置
            for (int i = 0; i < length; i++)
            {
                if(array[i] == value)
                {
                    RemoveAt(i);
                    return;
                }
            }
            Console.WriteLine("没有在数组中找到{0}",value);
        }

        //指定索引删除
        public void RemoveAt(int index)
        {
            if(index > length)
            {
                Console.WriteLine("当前数组只有{0},你越界了",length);
                return;
            }
            for (int i = index; i < length - 1; i++)
            {
                array[i] = array[i + 1];
            }
            --length;
        }

        //查改
        public int this[int index]
        {
            get
            {
                if(index >= length || index < 0)
                {
                    Console.WriteLine("越界了");
                    return 0;
                }
                return array[index];
            }
            set
            {
                if (index >= length || index < 0)
                {
                    Console.WriteLine("越界了");
                }
                array[index] = value;
            }
        }

        public int Length
        {
            get
            {
                return length;
            }
        }
    }

    #endregion

    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("索引器练习");

            IntArray intArray = new IntArray();
            intArray.Add(1);
            intArray.Add(2);
            Console.WriteLine(intArray.Length);
            //intArray.RemoveAt(1);
            intArray.Remove(2);
            Console.WriteLine(intArray[0]);
            //Console.WriteLine(intArray[1]);
            Console.WriteLine(intArray.Length);
            

        }
    }
}

Lesson7:封装--静态成员

练习:

Lesson8:封装-- 静态类和静态构造函数

Lesson9:封装--拓展方法

练习:

Lesson10:封装--运算符重载

练习:

Lesson11:封装--内部类和分部类

Lesson12:继承--继承的基本规则

练习:

Lesson13:继承--里氏替换原则

练习:

Lesson14:继承--继承中的构造函数

练习:

Lesson15:继承--万物之父和装箱拆箱

练习:

Lesson16:继承--密封类

练习:

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

namespace Lesson16_练习
{

    #region 练习
    //定义一个载具类
    //有速度,最大速度,可乘人数,司机和乘客等,有上车,下车,行驶,车祸等方法
    //用载具类申明一个对象,并将若干人装载上车

    class Car
    {
        public int speed;
        public int maxSpeed;
        //当前装了多少人
        public int num;
        
        public Person[] person;

        public Car(int speed, int maxSpeed, int num)
        {
            this.speed = speed;
            this.maxSpeed = maxSpeed;
            this.num = 0;
            person = new Person[num];
        }

        public void GetIn(Person p)
        {
            if(num >= person.Length)
            {
                Console.WriteLine("满载了");
                return;
            }
            person[num] = p;
            ++num;
        }

        public void GetOff(Person p)
        {
            for (int i = 0; i < person.Length; i++)
            {
                if(person[i] == null)
                {
                    break;
                }
                if (person[i] == p)
                {
                    //移动位置
                    for (int j = i; j < num - 1; j++)
                    {
                        person[j] = person[j + 1];
                    }
                    //最后一个位置清空
                    person[num - 1] = null;
                    --num;
                    break;
                }
            }
        }

        public void Move()
        {

        }

        public void Boom()
        {
             
        }
        
    }

    class Person
    {

    }

    class Driver : Person
    {

    }

    class Passenger : Person
    {

    }

    #endregion

    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("封装继承综合练习");

            Car car = new Car(80, 100, 20);
            Driver driver = new Driver();
            Passenger p1 = new Passenger();
            Passenger p2 = new Passenger();
            Passenger p3 = new Passenger();
            car.GetIn(driver);
            car.GetIn(p1);
            car.GetIn(p2);
            car.GetIn(p3);
            car.GetOff(p1);

        }
    }
}

练习调试!!!

Lesson17:多态--vob

通过这节课的知识--解决了Lesson13 的练习题

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

namespace Lesson13_练习
{

    #region 练习一
    //is和as的区别
    //is 用于判断 类对象判断是不是某个类型的对象  bool
    //as 用于转换 把一个类对象 转换成一个指定类型的对象  null
    #endregion

    #region 练习二
    //写一个Monster类,它派生出Boss和Gobin两个类
    //Boss有技能,小怪有攻击
    //随机生成10个怪,装载到数组中
    //遍历这个数组,调用他们的攻击方法,如果是boss就释放技能

    class Monster
    {

    }

    class Boss : Monster
    {
        public void Skill()
        {
            Console.WriteLine("Boss释放技能");
        }
    }

    class Goblin : Monster
    {
        public void Atk()
        {
            Console.WriteLine("小怪攻击");
        }
    }
    #endregion

    #region 练习三
    //FPS游戏模拟
    //写一个玩家类,玩家可以拥有各种武器
    //线在有四种武器,冲锋枪,散弹枪,手枪,匕首
    //玩家默认拥有匕首
    //请在玩家类中写一个方法,可以拾取不同的武器替换自己拥有的武器

    class Weapon
    {
        public virtual string Input()
        {
            return null;
        }
    }

    /// <summary>
    /// 冲锋枪
    /// </summary>
    class SubmachineGun : Weapon
    {
        public override string Input()
        {
            return "冲锋枪";
            //Console.WriteLine("冲锋枪");
        }
    }

    /// <summary>
    /// 散弹枪
    /// </summary>
    class ShotGun : Weapon
    {
        public override string Input()
        {
            return "散弹枪";
            //Console.WriteLine("散弹枪");
        }
    }

    /// <summary>
    /// 手枪
    /// </summary>
    class Pistol : Weapon
    {
        public override string Input()
        {
            return "手枪";
            //Console.WriteLine("手枪");
        }
    }

    /// <summary>
    /// 匕首
    /// </summary>
    class Dagger : Weapon
    {
        public override string Input()
        {
            return "匕首";
            //Console.WriteLine("匕首");
        }
    }

    class Player
    {
        private Weapon nowHaveWeapon;

        public Player()
        {
            nowHaveWeapon = new Dagger();
        }

        public void PickUp(Weapon weapon)
        {
            nowHaveWeapon = weapon;
        }

        public void Show()
        {
            Console.WriteLine("当前玩家使用的武器是:{0}",nowHaveWeapon.Input());
        }
    }

    #endregion

    class Program
    {
        static void Main(string[] args)
        {

            Console.WriteLine("里氏替换原则练习");

            //随机生成10个怪物
            Monster[] objects = new Monster[10];
            Random r = new Random();
            int box = 0;
            for (int i = 0; i < objects.Length; i++)
            {
                box = r.Next(1, 3);
                if(box == 1)
                {
                    objects[i] = new Boss();
                }
                else
                {
                    objects[i] = new Goblin();
                }
            }

            //遍历数组
            for (int i = 0; i < objects.Length; i++)
            {
                if(objects[i] is Boss)
                {
                    (objects[i] as Boss).Skill();
                }
                else if(objects[i] is Goblin)
                {
                    (objects[i] as Goblin).Atk();
                }
            }


            Player p = new Player();
            p.Show();
            Weapon submachineGun = new SubmachineGun();
            
            p.PickUp(submachineGun);
            p.Show();

            //遗留一个问题:重写?!!
            //通过学习Lesson17--多态ovb    得以解决
        }
    }
}

练习:

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

namespace Lesson17_练习
{

    #region 练习一
    //真的鸭子嘎嘎叫,木头鸭子吱吱叫,橡皮鸭子唧唧叫
    class Duck
    {
        public virtual void Speak()
        {
            Console.WriteLine("嘎嘎叫");
        }
    }

    class WoodDuck : Duck
    {
        public override void Speak()
        {
            //base.Speak();
            Console.WriteLine("吱吱叫");
        }
    }

    class RubberDuck : Duck
    {
        public override void Speak()
        {
            //base.Speak();
            Console.WriteLine("唧唧叫");
        }
    }
    #endregion

    #region 练习二
    //所有员工9点打卡
    //但经理十一点打卡,程序员不打卡

    class Staff
    {
        public virtual void PunchTheClock()
        {
            Console.WriteLine("普通员工9点打卡");
        }
    }

    class Manager : Staff
    {
        public override void PunchTheClock()
        {
            //base.PunchTheClock();
            Console.WriteLine("经理11点打卡");
        }
    }

    class Programmer : Staff
    {
        public override void PunchTheClock()
        {
            //base.PunchTheClock();
            Console.WriteLine("程序员不打卡");
        }
    }

    #endregion

    #region 练习三
    //创建一个图形类,有求面积和周长两个方法
    //创建矩形类,正方形类,圆形类继承图形类
    //实例化矩形,正方形,圆形对象求面积和周长

    class Graph
    {
        public virtual float GetLength()
        {
            return 0;
        }

        public virtual float GetArea()
        {
            return 0;
        }
    }

    class Rect : Graph
    {
        private float w;
        private float h;

        public Rect(float w, float h)
        {
            this.w = w;
            this.h = h;
        }

        public override float GetLength()
        {
            //return base.GetLength();
            return 2 * (w + h);
        }

        public override float GetArea()
        {
            //return base.GetArea();
            return w * h;
        }
    }

    class Square : Graph
    {
        private float h;

        public Square(float h)
        {
            this.h = h;
        }

        public override float GetLength()
        {
            //return base.GetLength();
            return 4 * h;
        }

        public override float GetArea()
        {
            //return base.GetArea();
            return h * h;
        }
    }

    class Circule : Graph
    {
        private float r;

        public Circule(float r)
        {
            this.r = r;
        }

        public override float GetLength()
        {
            //return base.GetLength();
            return 2 * 3.14F * r;
        }

        public override float GetArea()
        {
            //return base.GetArea();
            return 3.14f * r * r;
        }
    }

    #endregion

    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("多态ovb");
            Console.WriteLine("virtual   override   base");

            Duck d = new Duck();
            d.Speak();

            Duck wd = new WoodDuck();
            wd.Speak();

            Duck rd = new RubberDuck();
            rd.Speak();


            Staff s = new Staff();
            s.PunchTheClock();

            Staff ma = new Manager();
            ma.PunchTheClock();
            (ma as Manager).PunchTheClock();

            Staff pr = new Programmer();
            (pr as Programmer).PunchTheClock();

            Rect r = new Rect(2, 4);
            Console.WriteLine("矩形的周长是:" + r.GetLength());
            Console.WriteLine("矩形的面积是:" + r.GetArea());

            Square sq = new Square(4);
            Console.WriteLine("正方形的周长是:" + sq.GetLength());
            Console.WriteLine("正方形的面积是:" + sq.GetArea());

            Circule ci = new Circule(3);
            Console.WriteLine("圆的周长是:" + ci.GetLength());
            Console.WriteLine("圆的面积是:" + ci.GetArea());

        }
    }
}

Lesson18:多态--抽象类和抽象方法

练习:

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

namespace Lesson18_练习
{

    #region 练习一
    //写一个动物抽象类,写三个子类
    //人叫、狗叫、猫叫

    abstract class Animal
    {
        public abstract void Speak();
    }

    class Person : Animal
    {
        public override void Speak()
        {
            Console.WriteLine("人在说话");
        }
    }

    class Dog : Animal
    {
        public override void Speak()
        {
            Console.WriteLine("狗在汪汪叫");
        }
    }

    class Cat : Animal
    {
        public override void Speak()
        {
            Console.WriteLine("猫在喵喵叫");
        }
    }

    #endregion

    #region 练习二
    //创建一个图形类,有求面积和周长两个方法
    //创建矩形类,正方形类,圆形类继承图形类
    //实例化矩形,正方形,圆形对象求面积和周长

    abstract class Graph
    {
        public abstract float GetLength();

        public abstract float GetArea();
    }

    class Rect : Graph
    {
        private float w;
        private float h;

        public Rect(float w, float h)
        {
            this.w = w;
            this.h = h;
        }

        public override float GetLength()
        {
            //return base.GetLength();
            return 2 * (w + h);
        }

        public override float GetArea()
        {
            //return base.GetArea();
            return w * h;
        }
    }

    class Square : Graph
    {
        private float h;

        public Square(float h)
        {
            this.h = h;
        }

        public override float GetLength()
        {
            //return base.GetLength();
            return 4 * h;
        }

        public override float GetArea()
        {
            //return base.GetArea();
            return h * h;
        }
    }

    class Circule : Graph
    {
        private float r;

        public Circule(float r)
        {
            this.r = r;
        }

        public override float GetLength()
        {
            //return base.GetLength();
            return 2 * 3.14F * r;
        }

        public override float GetArea()
        {
            //return base.GetArea();
            return 3.14f * r * r;
        }
    }

    #endregion

    class Program
    {
        static void Main(string[] args)
        {

            Console.WriteLine("抽象类和抽象方法");

            Person p = new Person();
            p.Speak();
            Dog dog = new Dog();
            dog.Speak();
            Animal cat = new Cat();
            cat.Speak();

        }
    }
}

Lesson19:多态--接口

练习:重要,加深对接口的应用

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

namespace Lesson19_练习
{

    #region 练习一
    //人、汽车、房子都需要登记,人需要到派出所登记,汽车需要去车管所登记,房子需要去房管局登记
    //使用接口实现登记方法

    interface IRegister
    {
        void Register();
    }

    class Person : IRegister
    {
        public void Register()
        {
            Console.WriteLine("派出所登记");
        }
    }

    class Car : IRegister
    {
        public void Register()
        {
            Console.WriteLine("车管所登记");
        }
    }

    class Home : IRegister
    {
        public void Register()
        {
            Console.WriteLine("房管局登记");
        }
    }

    #endregion

    #region 练习二
    //麻雀、鸵鸟、企鹅、鹦鹉、直升机、天鹅
    //直升机和部分鸟能飞
    //鸵鸟和企鹅不能飞
    //企鹅和天鹅能游泳
    //除直升机,其他都能走
    //请用面向对象相关知识实现

    abstract class Bird
    {
        public abstract void Walk();
    }

    interface IFly
    {
        void Fly();
    }

    interface ISwimming
    {
        void Swimming();
    }

    //麻雀
    class Sparrow : Bird,IFly
    {
        public void Fly()
        {
            
        }

        public override void Walk()
        {
            
        }
    }

    //鸵鸟
    class Ostrich : Bird
    {
        public override void Walk()
        {

        }
    }

    //企鹅
    class Penguin : Bird,ISwimming
    {
        public void Swimming()
        {
            throw new NotImplementedException();
        }

        public override void Walk()
        {

        }
    }

    //鹦鹉
    class Parrot : Bird,IFly
    {
        public void Fly()
        {
            throw new NotImplementedException();
        }

        public override void Walk()
        {

        }
    }

    //天鹅
    class Swan : Bird,IFly,ISwimming
    {
        public void Fly()
        {
            throw new NotImplementedException();
        }

        public void Swimming()
        {
            throw new NotImplementedException();
        }

        public override void Walk()
        {

        }
    }

    //直升机
    class Helicopter : IFly
    {
        public void Fly()
        {
            throw new NotImplementedException();
        }
    }


    #endregion

    #region 练习三
    //多态来模拟移动硬盘、U盘、MP3插到电脑上读取数据
    //移动硬盘与U盘都属于存储设备
    //MP3属于播放设备
    //但他们都能插在电脑上传输数据
    //电脑提供一个USB接口
    //请实现电脑的传输数据的功能

    interface IUSB
    {
        void ReadData();
    }

    class StorageDevice : IUSB
    {
        public string name;
        public StorageDevice(string name)
        {
            this.name = name;
        }

        public void ReadData()
        {
            Console.WriteLine("{0}传输数据",name);
        }
    }

    class MP3 : IUSB
    {
        public void ReadData()
        {
            Console.WriteLine("MP3传输数据");
        }
    }

    class Computer
    {
        public IUSB usb1;
    }

    #endregion

    class Program
    {
        static void Main(string[] args)
        {

            Console.WriteLine("接口练习");

            IRegister p = new Person();
            p.Register();
            Car car = new Car();
            car.Register();
            Home home = new Home();
            home.Register();

            StorageDevice hd = new StorageDevice("移动硬盘");
            StorageDevice ud = new StorageDevice("U盘");
            MP3 mp3 = new MP3();

            Computer cp = new Computer();

            cp.usb1 = hd;
            cp.usb1.ReadData();
            cp.usb1 = ud;
            cp.usb1.ReadData();
            cp.usb1 = mp3;
            cp.usb1.ReadData();


        }
    }
}

Lesson20:多态--密封方法

Lesson21:面向对象相关--命名空间

练习:

Lesson22:面向对象相关--万物之父中的方法

练习:

Lesson23:面向对象相关--string

练习:

Lesson24:面向对象相关--StringBuilder

练习:

Lesson25:面向对象相关--结构体和类的区别

Lesson26:面向对象相关--抽象类和接口的区别

学习完成:

CSharp核心实践小项目见下一篇笔记!

牢记--多看!!!

你还有好多东西要学习呢,抓紧时间啊!!!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1382729.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Web前端-移动web开发——flex布局

移动web开发——flex布局 1.0传统布局和flex布局对比 1.1传统布局 兼容性好布局繁琐局限性&#xff0c;不能再移动端很好的布局 1.2 flex布局 操作方便&#xff0c;布局极其简单&#xff0c;移动端使用比较广泛pc端浏览器支持情况比较差IE11或更低版本不支持flex或仅支持部…

SouthernBiotech抗荧光淬灭封片剂

荧光淬灭又称荧光熄灭或萃灭&#xff0c;是指导致特定物质的荧光强度和寿命减少的所有现象。引起荧光淬灭的物质称为荧光淬灭剂。SouthernBiotech专门开发的Fluoromount-G系列荧光封片剂是以甘油为基础&#xff0c;加入抗荧光淬灭剂&#xff0c;可明显降低荧光淬灭现象&#xf…

使用setdefault撰写文本索引脚本(出自Fluent Python案例)

背景介绍 由于我们主要介绍撰写脚本的方法&#xff0c;所以用一个简单的文本例子进行分析 a[(19,18),(20,53)] Although[(11,1),(16,1),(18,1)] ambiguity[(14,16)] 以上内容可以保存在一个txt文件中&#xff0c;任务是统计文件中每一个词&#xff08;包括字母&#xff0c;数…

AI编程可视化Java项目拆解第一弹,解析本地Java项目

之前分享过一篇使用 AI 可视化 Java 项目的文章&#xff0c;同步在 AI 破局星球、知乎、掘金等地方都分享了。 原文在这里AI 编程&#xff1a;可视化 Java 项目 有很多人感兴趣&#xff0c;我打算写一个系列文章拆解这个项目&#xff0c;大家多多点赞支持~ 今天分享的是第一…

C语言之从浅入深一步一步全方位理解指针【附笔试题】

文章目录 前言从浅入深理解指针《第一阶段》一、内存和地址1.1 内存1.2 究竟该如何理解编址 二、指针变量和地址2.1 取地址操作符&#xff08;&&#xff09; 三、指针变量和解引用操作符&#xff08;*&#xff09;3.1 指针变量3.2 如何拆解指针类型3.3 解引用操作符 四、指…

OpenCV-Python的版本介绍及区别

OpenCV-Python版本介绍 OpenCV-Python有多个版本&#xff0c;每个版本都有其特定的功能和改进。以下是一些常见OpenCV-Python版本及其介绍和区别&#xff1a; OpenCV-Python 2.x版本 这是OpenCV-Python的旧版本&#xff0c;支持Python 2.x。它包含了许多传统的计算机视觉功能&…

rpc的正确打开方式|读懂Go原生net/rpc包

前言 大家好&#xff0c;这里是白泽&#xff0c;之前最近在阅读字节跳动开源RPC框架Kitex的源码&#xff0c;分析了如何借助命令行&#xff0c;由一个IDL文件&#xff0c;生成client和server的脚手架代码&#xff0c;也分析了Kitex的日志组件klog。当然Kitex还有许多其他组件&…

sqlilabs第五十三五十四关

Less-51(GET - GET - Error based - ORDER BY CLAUSE-String- Stacked injection) 手工注入 单引号闭合&#xff0c;和上一关一样堆叠注入解决 自动注入 和上一关一样 Less-52(GET - challenge - Union- 10 queries allowed -Variation 1) 手工注入 这一关开始后面的可以看…

Linux 内核如何根据设备树文件来匹配内核

一. 简介 上一篇文章学习了 Linux内核如何确定是否支持此设备&#xff0c;如果支持&#xff0c;设备就会启动 Linux 内核。 文章地址如下&#xff1a; 设备树根节点下的compatile属性的作用-CSDN博客 本文继上面文章的学习。这里简单看一下&#xff0c; Linux 内核是如何根…

学习资料: uni-app HBuilderX

编译器&#xff1a;HBuilderX HBuilderX-高效极客技巧 uni-app介绍&#xff1a;uni-app官网 uni-app 是一个使用 Vue.js 开发所有前端应用的框架&#xff0c;开发者编写一套代码&#xff0c;可发布到iOS、Android、Web&#xff08;响应式&#xff09;、以及各种小程序&#…

2023.1.13 关于在 Spring 中操作 Redis 服务器

目录 引言 前置工作 前置知识 实例演示 String 类型 List 类型 Set 类型 Hash 类型 ZSet 类型 引言 进行下述操作的前提是 你的云服务器已经配置好了 ssh 端口转发即已经将云服务器的 Redis 端口映射到本地主机 注意&#xff1a; 此处我们配置的端口号为 8888 可点击下…

C++力扣题目617--合并二叉树

给你两棵二叉树&#xff1a; root1 和 root2 。 想象一下&#xff0c;当你将其中一棵覆盖到另一棵之上时&#xff0c;两棵树上的一些节点将会重叠&#xff08;而另一些不会&#xff09;。你需要将这两棵树合并成一棵新二叉树。合并的规则是&#xff1a;如果两个节点重叠&#…

【STM32】FLASH闪存

1 FLASH闪存简介 本节所指STM32内部闪存&#xff0c;即下载程序的时候&#xff0c;程序存储的地方。&#xff08;非易失性&#xff09; STM32F1系列的FLASH包含程序存储器、系统存储器&#xff08;bootloader&#xff0c;不允许修改&#xff09;和选项字节三个部分&#xff0…

JavaScript学习笔记——变量、作用域、var、const和let

JavaScript学习笔记——变量、作用域、var、const和let 学习链接&#xff08;原链接&#xff09;变量变量声明的三种方式 作用域作用域介绍作用域分类全局作用域局部作用域&#xff08;函数作用域&#xff09;块级作用域块级作用域和局部(函数)作用域区别 varvar的作用域(全局函…

【elastic search】详解elastic search集群

目录 1.与集群有关的一些概念 2.集群搭建 3.集群搭建 4.kibana链接集群 5.选举流程 6.请求流程 7.master的作用 1.与集群有关的一些概念 数据分片&#xff1a; 数据分片&#xff08;shard&#xff09;&#xff0c;单台服务器的存储容量是有限的&#xff0c;把一份数据…

LINUX基础培训七之进程管理

前言、本章学习目标 了解LINUX中进程和程序掌握进程管理的作用和方法熟悉进程调度优先级了解LINUX信号 一、了解LINUX进程和程序 进程是正在执行的一个程序或命令&#xff0c;每个进程都是一个运行的实体&#xff0c;都有自己的地址空间&#xff0c;并占用一定的系统资源。 …

【Python学习】Python学习15-模块

目录 【Python学习】Python学习15-模块 前言创建语法引入模块from…import 语句from…import* 语句搜索路径PYTHONPATH 变量-*- coding: UTF-8 -*-导入模块现在可以调用模块里包含的函数了PYTHONPATH 变量命名空间和作用域dir()函数globals() 和 locals() 函数reload() 函数Py…

pytest -- 基本使用详解

1. pytest基本介绍 pytest 是一个功能强大且易于使用的 Python 测试框架&#xff0c;用于编写单元测试、集成测试和功能测试。 它提供了丰富的功能和灵活的用法&#xff0c;使得编写和运行测试变得简单而高效。 --------------->>>>> pytest框架优点&#xff1a…

C语言之字符串和指针

目录 用数组实现的字符串和用指针实现的字符串 █用数组实现的字符串str █用指针实现的字符串ptr 注意 用数组和指针实现字符串的不同点 字符串数组 用数组实现的字符串的数组——二维数组 用指针实现的字符串数组——指针数组 注意 字符串和指针有着紧密的联系&#…