
笔记
文章平均质量分 89
大魔王来巡山
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
设计模式简单解析
简单分析部分设计模式原创 2022-10-10 18:51:10 · 384 阅读 · 0 评论 -
QT启动外部进程并隐藏界面
QString program = QStringLiteral("··/Test/test.exe");STARTUPINFO si={sizeof(si)};PROCESS_INFORMATION pi;si.dwFlags= STARTF_USESHOWWINDOW|STARTF_USESTDANDLES;si.wShowWindow =false;CreateProcess(NULL,(LPWSTR)program.toStdWString().c_str(),NULL,NULL,FALS原创 2020-12-29 11:33:39 · 3598 阅读 · 2 评论 -
类的构造析构顺序
构造顺序:先基类,然后成员,再自己构造顺序:类静态成员变量-全局变量-基类-普通类成员变量-自己析构顺序:与构造相反#include <iostream>using namespace std;class A{public: A(){cout << "A()" << endl;} ~A(){cout << "~A()"" << endl;}}class B{public: B(){cout <原创 2020-09-09 11:42:47 · 1159 阅读 · 0 评论 -
sizeof和strlen的简单使用
#include <iostream>using namespace std;void test(char *s){ cout << s << endl; cout << strlen(s) << endl; cout << sizeof(s) << endl; cout << (void*)s << endl; cout << (void*)原创 2020-09-09 11:09:07 · 143 阅读 · 0 评论 -
C++基类加virtual的作用
class MyBase{public: MyBase(){cout << "MyBase" << endl;} ~MyBase(){cout << "~MyBase" << endl;}};class MyA : public MyBase{public: MyA(){cout << "MyA" << endl;} ~MyA(){cout << "~MyA" << e原创 2020-06-07 22:35:43 · 672 阅读 · 0 评论 -
C++中访问类成员变量的几种方式
例子#include <iostream>using namespace srd;class test{public: int a; double b; string c;};int main(){ test t; //第一种,这种方式原理未知 int test::*p = &test::a; double test::*q = &test::b; string test::*m = &te原创 2020-05-21 10:22:25 · 7910 阅读 · 0 评论 -
C++ 模拟智能指针
参考:C++智能指针——探究六个常见的智能指针的使用及原理模仿C++STL中share_ptr智能指针将普通指针存在一个类中,类随着作用域的结束,在析构函数中释放指针,所以这个类需要是放在栈区,离开作用域后自动执行析构类中有一个计数器,防止普通指针被多个类管理,多次释放造成程序崩溃普通指针只有一个,在多个智能指针之间传递地址,计数器也需要是指针,在多个智能指针之间传递地址,所以他们在多个智能指针对象中始终是一个#include <iostream>using namespace原创 2020-05-10 16:02:48 · 237 阅读 · 0 评论 -
C++的try_catch抛出异常
#include <iostream>#include <vector>using namespace std;void test(){ int a[5]; for (int i=0; i<=6; i++) { if(i>=5){ throw runtime_error("out of range"); } a[i] = 10; }}int main()原创 2020-05-10 14:07:56 · 262 阅读 · 0 评论 -
C++学习记录-整型转字符串方法记录
1//ostringstream、istringstream、stringstreamint i = 10;stringstream stream;stream << i; //i输出到stream中string str = stream.str();//或者string str;stream >> str; //将stream内容输入到str中2in...原创 2020-03-21 19:57:33 · 213 阅读 · 0 评论 -
C++连接SQL Server
VS新建一个空项目,添加新文件main.cppmain.cpp内容如下:#include <Windows.h>#include <string>using namespace std;#import "c:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF", ...原创 2020-02-28 11:39:45 · 5826 阅读 · 0 评论 -
批处理启用系统管理员设置密码
在别人的问答中看到的,转载https://bbs.51cto.com/thread-1516481-1-1.html可以用BAT或者VBS脚本启动脚本来做,但是要确保本地administrator的名未被修改,否则就要先判断、再提取修改后的名字写入到下面命令中。1、BATnet user administrator /active:yesnet user administrator P@s...原创 2020-01-14 15:28:19 · 1899 阅读 · 0 评论