由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - C++ 问题
相关主题
急问:compile and build dependency[合集] C++的弱问题
C++ questionfind bugs of c++ codes
问一个 copy constructor 的问题 (C++)const object
c++ initialize structWhat does the default constructor do?
c++ questionC calls C++ library
C++ 中 myobject * a =new myobject[n] 的问题C++的一个小疑问,求解惑
一道c++的考古题问个copy constructor的问题
回答C++的弱问题Test your C++ knowledge...
相关话题的讨论汇总
话题: ctor话题: compiler话题: copy话题: c++
进入Programming版参与讨论
1 (共1页)
e**e
发帖数: 41
1
如果一个class 除去定义了一个copy constructor, 没有其他constructor,
这样一来compiler也就不会产生default constructor.
这背后的rational是什么? compiler 应该可以生成一个default constructor.
觉得copy ctor 和一般的 ctor 应该区别对待.
谁对标准懂,能说说吗?
X****r
发帖数: 3557
2


【在 e**e 的大作中提到】
: 如果一个class 除去定义了一个copy constructor, 没有其他constructor,
: 这样一来compiler也就不会产生default constructor.
: 这背后的rational是什么? compiler 应该可以生成一个default constructor.
: 觉得copy ctor 和一般的 ctor 应该区别对待.
: 谁对标准懂,能说说吗?

d****n
发帖数: 1637
3
哦,大牛说这是龟腚
N*****m
发帖数: 42603
4
没看到规定,只看到龟尾

【在 X****r 的大作中提到】

e**e
发帖数: 41
5
知道是规定. 就是想知道standard 这么做的原因(如果有)
因为只有copy ctor, 这个class还是不能使用, 因为没有ctor.

【在 X****r 的大作中提到】

N***m
发帖数: 4460
6

啥叫不嫩用啊,你可以用工厂模式阿

【在 e**e 的大作中提到】
: 知道是规定. 就是想知道standard 这么做的原因(如果有)
: 因为只有copy ctor, 这个class还是不能使用, 因为没有ctor.

e**e
发帖数: 41
7
给个例子咱学习一下.

【在 N***m 的大作中提到】
:
: 啥叫不嫩用啊,你可以用工厂模式阿

N***m
发帖数: 4460
8
好像我说的驴唇不对马嘴,说错了,不好意思。

【在 e**e 的大作中提到】
: 给个例子咱学习一下.
b*****e
发帖数: 474
9
很自然的吧,既然有自定义的ctor,就不要有缺省的了吧

【在 e**e 的大作中提到】
: 知道是规定. 就是想知道standard 这么做的原因(如果有)
: 因为只有copy ctor, 这个class还是不能使用, 因为没有ctor.

1 (共1页)
进入Programming版参与讨论
相关主题
Test your C++ knowledge...c++ question
C++ online Test 2题C++ 中 myobject * a =new myobject[n] 的问题
question about c++ constructor一道c++的考古题
a simple question about constructor回答C++的弱问题
急问:compile and build dependency[合集] C++的弱问题
C++ questionfind bugs of c++ codes
问一个 copy constructor 的问题 (C++)const object
c++ initialize structWhat does the default constructor do?
相关话题的讨论汇总
话题: ctor话题: compiler话题: copy话题: c++