c++继承

本文介绍了C++中的类继承概念,包括默认私有继承的机制,以及类内派生(public、protected、private)的区别。同时提及了线程池和数据解析处理在池化技术中的应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

继承

c++默认私有继承

类内派生 public、private、protected都一样


// c++基本语法.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
#include<string>
using namespace std;

class Parent {
public:
    int name;
protected:
    string bank;
private:
    string qizi;

};

//默认私有继承

class Child :public Parent {

    void test() {
        this->name;
        this->bank;
        //this->qizi  私有的
    }
};

class Child1 :protected Parent {

    void test() {
        this->name;
        this->bank;
        //this->qizi  私有的
    }
};


class Child2 :private Parent {

    void test() {
        this->name;
        this->bank;
        //this->qizi  私有的
    }
};


int main()
{
    cout << "Hello World!\n";
}


类外派生,什么都不写,默认为私有继承,类外均不能访问

线程池

//线程池 消息队列
//池化技术:
//池:缓冲的作用
作用:

  1. 数据解析
  2. 处理fd

在这里插入图片描述
厨师:去任务 、执行任务

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值