Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #32931

What goes wrong with cloning here

From Cecil Westerhof <Cecil@decebal.nl>
Newsgroups comp.lang.java.programmer
Subject What goes wrong with cloning here
Date 2015-10-23 17:49 +0200
Organization Decebal Computing
Message-ID <87oafplh3t.fsf@Equus.decebal.nl> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

I need to use Cloneable. (I know that some people say you should never
use it, but it is a requirement of the project.)

I made something I thought should work, but it does not. I have
attached my dumbed down code. What am I doing wrong?

When I in class A change a field from class B in the clone, the field
in the original is also changed. That should not happen.

Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

What goes wrong with cloning here Cecil Westerhof <Cecil@decebal.nl> - 2015-10-23 17:49 +0200
  Re: What goes wrong with cloning here Tassilo Horn <tsdh@gnu.org> - 2015-10-23 18:12 +0200
    Re: What goes wrong with cloning here Cecil Westerhof <Cecil@decebal.nl> - 2015-10-24 00:51 +0200
      Re: What goes wrong with cloning here Cecil Westerhof <Cecil@decebal.nl> - 2015-10-24 01:44 +0200

csiph-web