#Changing the object used to construct something else after making it

4 messages · Page 1 of 1 (latest)

tardy cairn
#

I am just wondering if there is something I could do to make it so this would print 4 (i.e. make obj2 create a copy of obj1 that is stored somewhere else in memory) (it prints 5)

hollow stratusBOT
#

This post has been reserved for your question.

Hey @tardy cairn! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

sacred pagoda
#

Errrm...

OtherClass(MyClass obj) {
  this.obj = new MyClass(obj.getX());
}