随笔分类 - 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
阅读全文
摘要:1. 函数模板 目的:使用模板的目的就是能够让程序员编写与类型无关的代码。 语法格式: //class 可以与 typename 互换 template <class 形参名,class 形参名,......> 返回类型 函数名(参数列表) { 函数体 } 示例: #include <iostrea
阅读全文
摘要:#include <thread> #include <iostream> using namespace std; void ThreadMain() { cout<<"begin subthread main"<<this_thread::get_id()<<endl; for(int i =0
阅读全文