摘要:
#include <stdio.h>struct Ex{ static int gId; int id; Ex(){id=gId++;printf("Ex()-id=%d/n",id);} Ex(const Ex &e){id=gId++;printf("Ex(e)-id=%d,copy from %d/n", id, e.id);} ~Ex(){printf("~Ex()-id=%d/n",id);}};int Ex::gId;void func1(void){ try { throw Ex(); // crea 阅读全文
摘要:
#include <stdio.h>#include <stdlib.h>struct A{ int a; int b; int c; A() {a=0; printf("A()/n");} A(int _a) {a=_a;} ~A() {printf("~A()/n");} void *operator new[](unsigned int s) // 无论如何 's'传递的是大小,而不是数组元素个数 // gcc编译环境下这个值是 sizeof((n) * sizeof(A))+4, // 估计这4字节用来作为 阅读全文