Consider the given code
struct ABC
{
ABC()
{
std::cout<<" Calling from default constructor";
}
ABC(const ABC ©)
{
std::cout<<"Calling from copy constructor";
}
};
int main()
{
ABC abc = ABC();
}
I have two questions
Q1) Removing const from the copy constructor parameter declaration gives error. Why?
Q2) After adding the const keyword I dont see a call to the copy constructor. Why? The copy constructor does not get called so why is the const necessary?
TIA