The first method does not use the copy constructor and allows to change the original object. While the second method uses the copy constructor to create a temporary object and therefore does not allow to change the original object.
Thank u for your answer. So the second method returns a copy of a?
so after calling the second method I have 2 A objects? and if it is a copy of a why cant I change it? after all its a copy i.e. different object