重载operator new 和delete
#include<iostream>
using namespace std;
class S{
public:
S(int=2):a(2){cout<<"S(int=2)\n";}
void *operator new(size_t);
void operator delete (void *);
int a;
~S(){
cout<<"~S()\n";
}
};
void * S::operator new(size_t){
cout<<"void *S:new(size_t)"<<endl;
return ::new S;
}
void S::operator delete(void *a){
cout<<"void *S::delte"<<endl;
}
void main(){
S *aa=new S;
cout<<aa->a<<'\n';
delete aa;
}
构造函数为什么执行两次
为何会在delete aa;中会调用~S(),我重载了delete但是没有调用~S()
相关推荐
springboot+shiro+websocket+swagger
springboot和一些框架的整合,swagger有问题可能会打不开
springbootDemo
springboot+mybatis+shiro+thymeleaf技术,权限管理还没添加进去,只是基本配置ok了,会继续进行更新
基于SpringBoot2+Shiro+Thymeleaf的后台管理系统.zip
免费下载,适合做毕业设计,课程设计,项目工程等。所有源码均经过测试,可直接运行,免费下载,下就完事了
SpringBoot+Layui后台管理系统.zip
SpringBoot+Layui后台管理系统
springboot框架与其它结合如jpa、mybatis、websocket、security、shiro、cache.zip
springboot-shiro 是博客 springboot集成shiro 实现权限控制 springBoot-Quartz 博客 springBoot-Quartz 定时任务 springboot 整合mybatis2 springboot 整合mybatis2 更简便的整合方式 springboot+Kafka kafka 与 sprigboot 的结合,springboot 从Kafka中读取数据的小例子 springboot+es Elasticsearch 与 sprigboot 的结合,springboot 操作es的小例子 Springboot多数据源切换 springboot 多个数据源的配置, 一个springboot 项目操作多个数据库的数据 springboot-dubbo 该项目是Springboot 和 dubbo 结合的例子,是provider 的示例,提供服务。简单的写了一些用户和权限的接口没有写的很完整,主要是为了提现dubbo 服务 Springboot-shiro2 也是和dubbo 的结合例子是 消费者的示例。


