今天看《C++ Primer》的13.1节——Copy, Assign, and Destroy
被这几个玩意儿弄得晕得不行:
◆ Copy Constructor
◆ The Copy-Assignment Operator
◆ Destructor
主要问题集中在:
◆ 我们在什么时候需要自己重写?...
分类:
其他好文 时间:
2014-09-29 00:05:26
阅读次数:
319
In classical object-oriented programming languages, a constructor is a special method used to initialize a newly created object once memory has been a...
分类:
编程语言 时间:
2014-09-28 22:56:05
阅读次数:
213
#include#includeusingnamespacestd;classA{private:intdata;//dataint*pi;//pointtodatapublic://禁止隐式转换A(){data=0;pi=&data;}~A(){data=-999999;pi=nullptr;}e...
分类:
编程语言 时间:
2014-09-28 20:50:25
阅读次数:
166
假如有下面这样一个类:
class A{
public:
A(int p, char q):x(p), c(q){ cout << "constructor called" << endl; }
A(const A& a){x = a.x; c = a.c; cout << "copy constructor called" << endl;}
~A(){cout << "destruc...
分类:
编程语言 时间:
2014-09-28 02:30:00
阅读次数:
160
一直分不清的两个东西,今天记录一下,java反射与动态代理
java反射:1、在运行时分析类的能力
2、在运行是查看对象
3、实现数组的操作代码
4、利用Method对象
在java.lang.reflect包中有三个类Field、Method、Constructor分别用于描述类的域、方法和构造器,这三个类都有一个叫做getName的方法,用来返回相应的名称。
...
分类:
编程语言 时间:
2014-09-28 01:18:00
阅读次数:
256
C++11支持移动语义。一:为什么需要移动语义和什么是移动语义我们先来看看C++11之前的复制过程。假设有下列代码:vector v1(1000000);//v1存放着100W个string,假设每个string长度为1000vector v2(v1);//使用v1初始化v2vector和strin...
分类:
编程语言 时间:
2014-09-24 19:39:38
阅读次数:
1895
helloworld 代码说明: constructor-arg 用来表示通过构造方式来注入参数 index="0" 代表构造方法中的第一个参数
分类:
编程语言 时间:
2014-09-23 18:33:55
阅读次数:
220
对持久化对象的要求
1、 提供一个无参构造器,使Hibernate可以使用Constructor.newInstace()来实例化持久化对象
2、提供一个标识属性(identifier property)。通常映射为数据库表的主键字段,如果没有该属性,一些功能将不起作用,如Session.saveOrUpdate()。
3、 为持久化类的字段声明访问方法(set/get)。Hibernate...
分类:
其他好文 时间:
2014-09-22 19:06:03
阅读次数:
243
在Eclipse中编写Java代码时,用到了BASE64Decoder,import sun.misc.BASE64Decoder;可是Eclipse提示:Access restriction : The type BASE64Decoder is not accessible due to res...
分类:
数据库 时间:
2014-09-22 15:11:42
阅读次数:
219