No difference found
#include<iostream> using namespace std; class AAA{ private: int num; public: AAA() : num(0){}; AAA &CreateInitObject(int n) const//n값 안변함 보장 { AAA *gms = new AAA(n); return *gms; } void const Shownum() { cout << num << endl; } private: AAA(int a){ num = a; } }; int main(){ AAA base; base.Shownum(); AAA &obj1 = base.CreateInitObject(3); obj1.Shownum(); delete &obj1; return 0; }