Why doesn't line# 21 create an object of type `C' class? I think the
default construction function invocation `C()' creates a temporary
nameless object, and `o1' will be built with the copy construction
function of the same class from this temporary object. With g++ (GCC)
3.4.2 (mingw-special), line 21 doesn't create `o1' as type of `C'
class. No default and copy constructions are called for this line. I
don't understand this.
For line 22, only C::C(int) is called, no copy construction is called.
Could you please explain this also?
#include <iostream>
class C
{
public:
C(){
std::cout << "C()" << std::endl;
}
C(int ){
std::cout << "C(int)" << std::endl;
}
C(const C &){
std::cout << "C(const C &)" << std::endl;
}
};
int main()
{
C o1(C()); /*line 21*/
C o2(C(0)); /*line 22*/
C o3(o2);
}