随笔分类 -  C++

摘要:1. 区别与应用 2. 示例 struct A{}; class B : A{};//private继承 struct C : B{}; //public继承 struct A//定义一个struct { char c1; int n2; double db3; }; A a={'p',7,3.14 阅读全文
posted @ 2023-01-04 11:52 二先生- 阅读(15) 评论(0) 推荐(0) 编辑
摘要:1. 函数模板 目的:使用模板的目的就是能够让程序员编写与类型无关的代码。 语法格式: //class 可以与 typename 互换 template <class 形参名,class 形参名,......> 返回类型 函数名(参数列表) { 函数体 } 示例: #include <iostrea 阅读全文
posted @ 2022-11-10 09:30 二先生- 阅读(36) 评论(0) 推荐(0) 编辑
摘要:#include <thread> #include <iostream> using namespace std; void ThreadMain() { cout<<"begin subthread main"<<this_thread::get_id()<<endl; for(int i =0 阅读全文
posted @ 2022-07-18 17:07 二先生- 阅读(21) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示