I can't upload the picture.
using namespace std;
int cmxObjCnt=0;
class SoComplex { public: SoComplex() { cmxObjCnt++; cout<<cmxObjCnt<<"Third Object"<<endl; } SoComplex(SoComplex ©){ cmxObjCnt++; cout<<cmxObjCnt<<"Third Object"<<endl; } };
int main() { SoComplex com1; SoComplex com2=com1; SoComplex(); return 0; }
This is an example of Yoon Sungwoo's passionate C++ I wrote it down except for some codes. But SoComplex() in the main; calls the constructor in the SoComplex class? Can you call the constructor separately like that?
c++
Yes, it is correct to call the SoComplex() default constructor in the class.
© 2024 OneMinuteCode. All rights reserved.