I write a simple code,My question is:why item_base just call constrcut function?Should item_base call "copy construct function" ?I observe that when I create item_base2,it calls "copy construct function",but item_base doesn't call "copy construct function".what's the difference?
class Item_base {
public:
Item_base();
Item_base(int);
Item_base(const Item_base &base);
void operator=(const Item_base &item);
virtual ~Item_base();
};
Item_base::Item_base()
{
cout << "construct function" << endl;
}
Item_base::Item_base(int a)
{
cout << "arg construct function" << endl;
}
Item_base::Item_base(const Item_base &base)
{
cout << "copy function" << endl;
}
void Item_base::operator=(const Item_base &item)
{
cout << "= operator" << endl;
}
Item_base::~Item_base()
{
}
int main()
{
//cout << "Hello world!" << endl;
Item_base item_base = Item_base(1);//construct function
Item_base item_base2 = item_base;//copy construct function
Item_base item_base3;
item_base3 = item_base2;// =operator function
return 0;
}