摘要:
NULL In C In C++98 In C++11 From the description of "cpluscplus reference" , we can see that NULL's definition is compiler dependent. In this blog, I 阅读全文
摘要:
不能重载的运算符 前两个运算符不能重载是为了保证访问成员的功能不能被改变,域运算符和sizeof 运算符的运算对象是类型而不是变量或一般表达式,不具备重载的特征。 只能重载为成员函数的运算符 因为这些运算符类本身就默认存在,不重载的话类会自动生成一个,比如"="运算符,假设有个class A, A 阅读全文
摘要:
see the following two examples, the conclusion is that we should define variable in the loop if it can. c++ //test1.cc outside the loop include int ma 阅读全文
摘要:
1. 《C++ Primer》 用class和struct关键字定义类的唯一差别在于默认访问级别:默认情况下,struct的成员为public,而class的成员为private。 2. class关键字还可以用于定义模板类型,struct不可以。 c++ include class C0 { in 阅读全文
摘要:
C/C++中的函数指针 一、引子 今天无聊刷了leetcode上的一道题,如下: Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle va 阅读全文