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.
|