![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++读书笔记
aaa-bbb-ccc
这个作者很懒,什么都没留下…
展开
-
字体:获取字体尺寸
//Gdiplus::Font grFont(_TEXT("微软雅黑"), 14); StringFormat stringformat(StringAlignmentNear); // 接收字体的显示区域,如宽高 Gdiplus::Font font(m_PaintManager.GetPaintDC(), m_PaintManager.GetFont(0)); Gra原创 2015-12-01 18:42:51 · 1111 阅读 · 0 评论 -
友元函数和友元类
class C1{public: C1(int a, int b) : m_a(a) , m_b(b) { }private: int add() { return m_a + m_b; }private: int m_a; int m_b; friend int add(C1& a); //声明友元函数 friend class C2;原创 2016-01-25 11:17:37 · 241 阅读 · 0 评论 -
术语与缩写解释
非原创,来自林锐的《高质量程序设计指南》1、ADT/UDT : Abstract Data Type /User Defined Types 抽象数据类型 / 用户定义类型2、Adapter:适配器3、COM:Component Object Model,组件对象模型4、Container:容器5、CORBA:Common Object Request Bro转载 2016-01-28 11:38:28 · 2222 阅读 · 0 评论 -
C++ 模板
1、模板函数调用之前声明模板函数的类型2、模板类1)成员函数前都要加上template 2)而且类别名称应该使用ClassName3)声明对象时使用类型名称原创 2016-03-16 14:56:40 · 199 阅读 · 0 评论 -
MFC特性
一、 RTTI1、duilib 实现方式:CUIControl 声明 虚函数GetClassName(),衍生重写该函数2、Mfc实现方式:在类声明(Cxxx.h)的里面(一般在类声明的第一行代码)中插入DECLARE_DYNAMIC(Cxxx) ,在类的定义里面(Cxxx.cpp)里面(一般在头文件下面 类的构造函数上面)插入MPLEMENT_DYNAMIC(Cxxx, Cxxx原创 2016-03-16 17:06:36 · 972 阅读 · 0 评论 -
C++ 关键字理解
1、const 关键字void Function(int a) const{} 该关键字限定成员函数不可修改成员变量原创 2015-09-24 09:52:01 · 373 阅读 · 0 评论 -
选择C runtime 函数库
Visual C++ 编译器提供下列选项,让我们决定使用哪一个C runtime 函数库:/ML Single-Threaded(static)/MT Multithreaded(static)/MD Multithreaded DLL(dynamic import library)/MLd Debug Single-Threaded(static)/MTd Debug Mul原创 2016-03-15 16:04:26 · 344 阅读 · 0 评论 -
读书笔记:const_cast,reinterpret_cast,static_cast,dynamic_cast
1、reinterpret_cast Allows any pointer to be converted into any other pointer type. Also allows any integral type to be converted into any pointer type and vice versa.样例int _tmain(int原创 2015-11-13 09:15:53 · 280 阅读 · 0 评论 -
读书笔记:构造函数、析构函数、拷贝构造函数、赋值函数
一、构造函数和析构函数运行顺序 构造函数运行顺序:先调用基类的构造函数,然后初始化基类成员变量(调用构造函数(无限迭代)),接着调用本身构造函数,最后初始化成员变量(调用构造函数(无限迭代)) 析构函数运行顺序:与构造函数相反,首先执行自身析构函数,然后执行基类的析构函数。二、构造函数初始化列表: 不按照程序员安排的初始化列表顺序,而是按照原创 2015-11-17 08:56:27 · 505 阅读 · 0 评论 -
C++ 多态性的理解
C++的多态有:1、动态多态:即运行时绑定,也就是通过虚函数以及类继承等机制,让对象行为生效与运行时。class a{ virtual void fun() { cout<<"a.fun"<<endl;} }class b :public a{ void fun() { cout<<"b.fun"<<endl;}}//动态绑定函数f原创 2015-08-13 15:30:53 · 337 阅读 · 0 评论 -
指针常量和常量指针
#include "stdafx.h"void test(char * const p){ p++; //error *p = '3'; //ok}void test2(const char * p){ p++; //ok *p = '3'; //error}int _tmain(int argc, _TCHAR* argv[原创 2015-08-20 15:20:28 · 283 阅读 · 0 评论 -
STL:关键概念
1、向容器中插入一个对象时,被插入的实际上是该对象的复制品2、容器的许多算法,比如排序,查找,要求对容器的元素进行比较,所以,放入容器的对象所属的类,还应该实现 == 和原创 2015-08-20 17:59:33 · 367 阅读 · 0 评论 -
读书笔记:连接运算符##
//连接运算符## #define DOWHAT(name) Do##name int DoTest() { OutputDebugStringA("test pass!"); return 0; } int _tmain(int argc, _TCHAR* argv[]){ DOWHAT(Test)(); return 0;}原创 2015-11-12 17:41:21 · 300 阅读 · 0 评论 -
读书笔记:virtual关键字分析
1、当一个类被用来作为基类的时候,才会把析构函数写成虚函数 --注意是基类样例:没有基类class CBase { public: CBase(){ OutputDebugStringA("CCBase\n"); } //基类没有声明virtual ~CBase(){ OutputDebugStringA(原创 2015-11-13 10:49:36 · 278 阅读 · 0 评论 -
Windows读书笔记
MessageBox.ClassName=#32770原创 2015-09-14 14:37:11 · 369 阅读 · 0 评论 -
读书笔记:杂项
1、使用命令行生成GUID,如生成50个GUID到1.txt文件中uuidgen n50 >c:\\1.txt原创 2015-12-29 09:54:20 · 268 阅读 · 0 评论