摘要:
元数据,metadata,最本质的解读:data about data,info about information.1.(针对dotnet)反射是一种在运行时获取和使用元数据的技术。其本质在于元数据。对应一个程序集的描述是Assembly类,对应一个Class的元数据就是Type,当然还有ConstructorInfo、 PropertyInfo、FieldInfo、EventInfo、MethodInfo、ParameterInfo、Attribute等。2.Attribute也是反射一个非常诱人的技术,它可以使用户通过声明一个Attribute而附加一些有用的功能,声明Attribute 阅读全文
posted @ 2011-01-07 17:56
能巴
阅读(342)
评论(0)
推荐(0)
摘要:
1. Persistence in computer science refers to the characteristic of state that outlives the process that created it. 2. Serializatioin. In computer science, in the context of data storage and transmission, serialization is the process of converting a data structure or object into a format that can be 阅读全文
posted @ 2011-01-07 16:26
能巴
阅读(285)
评论(0)
推荐(0)
摘要:
1. 理解虚函数赖以生存的底层机制:vptr + vtable。虚函数的运行时实现采用了VPTR/VTBL的形式,这项技术的基础: ①编译器在后台为每个包含虚函数的类产生一个静态函数指针数组(虚函数表),在这个类或者它的基类中定义的每一个虚函数都有一个相应的函数指针。 ②每个包含虚函数的类的每一个实例包含一个不可见的数据成员vptr(虚函数指针),这个指针被构造函数自动初始化,指向类的vtbl(虚函数表) ③当客户调用虚函数的时候,编译器产生代码反指向到vptr,索引到vtbl中,然后在指定的位置上找到函数指针,并发出调用。2. 对于一个large project,对于一个frequent u 阅读全文
posted @ 2011-01-07 15:27
能巴
阅读(242)
评论(0)
推荐(0)
摘要:
来自coolshell。 有这样一个面试题——请把从1到1000的数打印出来,但你不能使用任何的循环语句或是条件语句。更不能写1000个printf或是cout。用C/C++语言。个人比较赞赏的思路是下面两个:1. 函数指针数组结合n/1000的结果作为数组的index。void yesprint(int i);void noprint(int i);typedef void(*fnPtr)(int);fnPtr dispatch[] = { yesprint, noprint };void yesprint(int i) {printf("%d\n", i);dispat 阅读全文
posted @ 2011-01-07 14:08
能巴
阅读(357)
评论(0)
推荐(0)

浙公网安备 33010602011771号