zoheb hassan wrote:I am aware that a copy constructor is meant for creating a copy of an object but when and why do we have to use it, why not rather just create a new object, Basically i am trying to understand why we make that choice of using a copy constructor??
What necessitates overriding of hashCode(), toString() & equals() methods of Object class??
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
You're welcomezoheb hassan wrote:Thanks Campbell Ritchie . . .
Please tell us where you read that.
. . . the static getInstance() method was not clear to me took some googling to find that it was a copy constructor.
. . .
zoheb hassan wrote:Question is are there any good light resources for getting hold of these concepts
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Campbell Ritchie wrote:I always though a copy constructor is used to make an identical copy of an instance. And I thought it was necessary for a class with mutable attributes.
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |