#include<iostream>
using std::cout;
using std::endl;
class AAA
{
public:
AAA(){
cout<<"AAA() 호출"<<endl;
}
AAA(const AAA& a){
cout<<"AAA(const A& a) 호출"<<endl;
}
};
int main()
{
AAA obj1;
AAA obj2=obj1;
return 0;
}
#include<iostream>
using std::cout;
using std::endl;
class AAA
{
int val;
public:
AAA(int i){
val=i;
}
AAA(const AAA& a){
cout<<"AAA(const A& a) 호출"<<endl;
val=a.val;
}
void ShowData(){
cout<<"val: "<<val<<endl;
}
};
void function(AAA a)
{
a.ShowData();
}
int main()
{
AAA obj(30);
function(obj);
return 0;
}
#include<iostream>
using std::cout;
using std::endl;
class AAA
{
int val;
public:
AAA(int i){
val=i;
}
AAA(const AAA& a){
cout<<"AAA(const A& a) 호출"<<endl;
val=a.val;
}
void ShowData(){
cout<<"val: "<<val<<endl;
}
};
AAA function(void)
{
AAA a(10);
return a;
}
int main()
{
function();
return 0;
}
int i = 10;
int j = j;
AAA i(10);
AAA j = i;