Everything has its lifecycle, from being created to disappearing. Pass by reference instead of pass by value 尽量用“传引用”pass reference 而不用“传值” pass value c语言中,什么都是通过传值来实现的,c++继承了这一传统并将它作为默认方式.除非明确指定,函数的形参parameter总是通过“实参argument的拷贝”来初始化的,函数的调用者得到的也是函数返回…
今天写代码是遇到这样一个问题error: expected constructor, destructor, or type conversion before '.' token:立马网上查,原来是说不能再全局域进行不能用于赋值.运算.调用函数等,只能做变量的声明和初始化变量. 下面是我出错的代码: #include <iostream> int a[100]; memset(a,0,sizeof(a));//出错的地方,不能再全局域对变量进行赋值操作 int main(){ //doing…
[错误]expected constructor, destructor, or type conversion before '.' token - 第八个游侠的日志 - 网易博客 [错误]expected constructor, destructor, or type conversion before '.' token 2012-08-27 03:02:27|  分类: 技术·程序 |  标签:  |字号大中小 订阅 今天犯一个低级的C++语法错误,这里记录一下,以防下次再错, 错误如…
Programming language evolves always along with Compiler's evolvement. 1. The C++ Object Model: Stroustrup's original (and still prevailing) C++ Object Model is derived from the simple object model by optimizing for space and access time. Non-static d…
Programming language evolves always along with Compiler's evolvement The semantics of constructors One of the most often heard complaints about C++ is that the compiler does things behind the programmer’s back. We shall know how underlying compiler d…
Programming has its own methodology. Layering is everywhere in real life,this why the pruchase and sale exist. Layering, Insert additional indirection 通过分层layering/add indirection来体现 "有一个" 或 "用...来实现’ composition /composite 使某个类的对象成为另一个类的数据…
attribute constructor&destructor 在看openwrt里libnl-tiny这个库的时候,遇到了C里面的构造函数这个概念. static void __init init_msg_size(void) { default_msg_size = getpagesize(); } 这个static函数没有显示被其它地方调用,但确用了__init修饰.__init定义在include/netlink-local.h中: #define __init __attribute…
Inheritance The pointer or reference to base class can address/be assigned with any of the classes derived from base class with virtual functions through mechanism of dynamic binding. There are three ways to support polymorphism: through implicit con…
Programming language evolves always along with Compiler's evolvement On the Cusp of the Object Model Templates Template are now the foundation for generic programming ( the Standard Template Library). Template are used in memory allocation strategies…
Programming language evolves always along with Compiler's evolvement The Semantics of Data The size of an empty base class or an empty derived class inherited from an empty base class is not 0. For some reason: virtual pointer to virtual function tab…