由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - a simple question about constructor
相关主题
关于数组动态分配的疑问???C++ 普及课程 (视频)1:Compiler Generated Functions
question for C++ constant关于C++ STL编译的疑问
c++ initialize struct请叫一个 template class constructor 的问题
One question in C programming怎么搞的?
[合集] 又学了一招class D:public B;
请推荐makefile generatorforward declaration
C++ templateC++ memcpy declaration use restrict keyword?
templatec++:constructor 一问
相关话题的讨论汇总
话题: compiler话题: generates话题: right话题: default
进入Programming版参与讨论
1 (共1页)
l*****d
发帖数: 359
1
1. if you define a constructor of a class A that takes a parameter without
default value "A(int){}", then the compiler will not generate a default
constructor for you, in which case "A ioa;" should not compile, is that right? does the compiler still generates the copy constructor for you?
f*****Q
发帖数: 1912
2
If no user-defined constructor exists for a class A and one is needed, the
compiler implicitly declares a default parameterless constructor A::A()

right? does the compiler still generates the copy constructor for you?

【在 l*****d 的大作中提到】
: 1. if you define a constructor of a class A that takes a parameter without
: default value "A(int){}", then the compiler will not generate a default
: constructor for you, in which case "A ioa;" should not compile, is that right? does the compiler still generates the copy constructor for you?

f*****Q
发帖数: 1912
3
I remember there should be something different if you have a reference in
your class.

right? does the compiler still generates the copy constructor for you?

【在 l*****d 的大作中提到】
: 1. if you define a constructor of a class A that takes a parameter without
: default value "A(int){}", then the compiler will not generate a default
: constructor for you, in which case "A ioa;" should not compile, is that right? does the compiler still generates the copy constructor for you?

t****t
发帖数: 6806
4

right?
right
does the compiler still generates the copy constructor for you?
yes if needed.

【在 l*****d 的大作中提到】
: 1. if you define a constructor of a class A that takes a parameter without
: default value "A(int){}", then the compiler will not generate a default
: constructor for you, in which case "A ioa;" should not compile, is that right? does the compiler still generates the copy constructor for you?

l*****d
发帖数: 359
5
thanks.

【在 t****t 的大作中提到】
:
: right?
: right
: does the compiler still generates the copy constructor for you?
: yes if needed.

1 (共1页)
进入Programming版参与讨论
相关主题
c++:constructor 一问[合集] 又学了一招
Test your C++ knowledge...请推荐makefile generator
几个问题C++ template
array allocation in ctemplate
关于数组动态分配的疑问???C++ 普及课程 (视频)1:Compiler Generated Functions
question for C++ constant关于C++ STL编译的疑问
c++ initialize struct请叫一个 template class constructor 的问题
One question in C programming怎么搞的?
相关话题的讨论汇总
话题: compiler话题: generates话题: right话题: default