You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2nd - you have to make changed field public because when you clone $this and try to modify some field you don't have an access to private and protected fields anymore. Leaving those fields with such liberal property visibility may lead to a lot of troubles.
Cloning an object does not change its scope. Thus, modifying a clone inside of the parent is perfectly valid and possible.
The text was updated successfully, but these errors were encountered:
My recommendation would be to drop the Copy trait entirely. It has limited value and potentially exposes the ability to modify objects that are not intended to be modified, due to copy being a public method.
The following statement is incorrect:
Cloning an object does not change its scope. Thus, modifying a clone inside of the parent is perfectly valid and possible.
The text was updated successfully, but these errors were encountered: