This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes copy constructor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "copy constructor" Watch "copy constructor" New topic
Author

copy constructor

Pritam Chatterjee
Greenhorn

Joined: Jul 31, 2011
Posts: 27

how and why to use copy constructors? Example


Pritam
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37884
    
  22
To create an object identical to the original one.
To prevent the original being altered.Rather than returning the “real” account, you are returning a copy. That allows code to play with the account object without altering the original account object.
Pritam Chatterjee
Greenhorn

Joined: Jul 31, 2011
Posts: 27

thanks..
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37884
    
  22
You’re welcome
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: copy constructor
 
Similar Threads
Australians: New HFSJ Book on eBay
Copying of column
Copy code to TextPad - no linefeeds??
Instructor's Solution to 4b
need help with a display method for an applet