Nice catch, Dae, I didn't see that one. I didn't look at the main function at all really, I just looked at the one line and overload functions. Yeah, experience is the best way to learn, you can read stuff and get a basic understanding, but not till you start using it, and getting "down and dirty" with it do you fully understand it and know what's going on.
Stud, I'll try to look for why it's not executing operator= again, I'll try to find something on overload operators themselves, maybe it'll explain it better.
What I'm trying to say is when you overload and operator, and then use that for a class, like assigning an Apple, how does it know to use that overloaded operator and no the default one? I thought that since you're assigning it to an Apple it'd need to return Apple so that it knew when you assign Apple, use that operator to assign it. But I guess it tests both lhs and rhs to see. For example taking an Apple and assigning to an int, you can't normally assign and Apple to anything but an Apple, so it must pick up that there's an overloaded operator and will use that (if there's not cause an error). But what if you return and int and take an int as a parameter? How would it know to use the overloaded operator then? Or would you not be able to do that, as I wouldn't see a point to anyway.And you said you can return any type, such as an int. But doesn't it know to call the operator in the class by the lhs? By assigning an something to an Apple?
Sorry, I can't make out what you are saying there. But, if you define your operator= function like this: