I'm new to C++ and just learned about overloading operators. I'm confused because it seems like I can assign one object to another without having to overload the "=" operator. Take this code as example:
class process
{
int size;
public:
process(int s)
{
size = s;
}
~process();
int getSize()
{
return size;
}
};
int main()
{
process p1(2);
process p2(3);
p1 = p2;
std::cout << p1.getSize() << "\n";
}
The output is:
3
As you can see, the info from the process class "p2" were copied to "p1", but I haven't overloaded the "=" operator. Why is this happening? Is there any place where I can have some concrete info about what C++ did for this to happen? Thanks.