博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Effective C++ item 6
阅读量:3577 次
发布时间:2019-05-20

本文共 226 字,大约阅读时间需要 1 分钟。

条款 6 :使用delete 明确拒绝编译器自动生成函数

method 1

将成员函数声明为private并且不予实现,无法显示调用可以使得编译器无法编译.

method 2

继承private修饰的copy construct以及operator,在derive类中就可以不需要任何设计,同时会拒绝使用默认的copy construct以及operator函数.

medthod 3

将要拒绝生成的默认函数用delete关键字修饰,则该函数不会生成.

转载地址:http://hcxgj.baihongyu.com/

你可能感兴趣的文章
springMVC开发步骤
查看>>
java反序列化漏洞学习之Apache Commons Collections
查看>>
springMVC的工作流程:
查看>>
JAVA学习笔记
查看>>
IDEA-Tips
查看>>
微信小程序 - 遇到的问题
查看>>
Vue+Elementui实现多个表格table合并
查看>>
SpringMVC入门项目
查看>>
初玩Activiti7一套组合拳,连连败退之下竟突破神功,且看SpringBoot整治Activiti7小老弟!
查看>>
Error creating bean with name ‘processEngine‘: FactoryBean threw exception on object creation; nest
查看>>
Tomcat找不到指定的路径D\apache-tomcat-9.0.12\backup\catalina.policy (系统找不到指定的路径).........
查看>>
spring连接c3p0出现错误 Connections could not be acquired from the underlying database!
查看>>
The server cannot or will not process the request due to something that is perceived to be a client
查看>>
unable to process parts as no multi-part configuration has been provided
查看>>
windows按照在idea上使用svn连接服务器遇到E120108: Unable to connect to a repository at URL
查看>>
如果不管你这么换jar包都不行,看这里No converter found for return value of type:
查看>>
unity自学笔记--光照
查看>>
java语法一些易忘知识点
查看>>
笔试DAY3
查看>>
笔试DAY4
查看>>