如何编写此副本构造函数? [英] How do I write this copy constructor?

查看:109
本文介绍了如何编写此副本构造函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在为下面的类编写副本构造函数时遇到麻烦.我收到一个编译器错误,上面写着:错误C2248'Data :: m_number':无法访问在类'Data'中声明的私有成员".有人可以帮我这个副本构造函数.你没有 指出我还需要一个副本分配运算符,我知道...
I am having trouble writing a copy constructor for the below class. I get a compiler error saying: "error C2248 'Data::m_number' : cannot access private member declared in class 'Data'". Can someone help me out with this copy constructor. You do not have to point out that I also need a copy assignement operator, I know that...

推荐答案

我在为下面的类编写副本构造函数时遇到麻烦.我收到一个编译器错误,上面写着:错误C2248'Data :: m_number':无法访问在类'Data'中声明的私有成员".有人可以帮我这个副本构造函数.你没有 指出我还需要一个副本分配运算符,我知道...
I am having trouble writing a copy constructor for the below class. I get a compiler error saying: "error C2248 'Data::m_number' : cannot access private member declared in class 'Data'". Can someone help me out with this copy constructor. You do not have to point out that I also need a copy assignement operator, I know that...


这篇关于如何编写此副本构造函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆