[QUOTE=Robber;29239351]That can't have taken long :v:[/QUOTE]
Size doesn't matter, it's the quality of craftsmanship.
Why is it that everywhere i look it says java passes by value, yet in my program its passing an image by reference
I think only immutable types are passed as values.
[QUOTE=Darwin226;29239179]Where have you been blank?[/QUOTE]
Just popped out for lunch.
[QUOTE=Darwin226;29239694]I think only immutable types are passed as values.[/QUOTE]
If I do this
[code]class shot
{
public Image image = null;
public float X;
public float Y;
public shot(float x, float y, float rotation, Image img){
image = img;
image.rotate(rotation);
//System.out.println(image.getRotation());
X = x;
Y = y;
}
}[/code]
Shouldnt the image be a copy of img?
Only every time I call the constructor everything in the shot list changes
As I said. I think only types like int, float, double, bool (maybe string, not sure) are passed by value.
All the instances of classes get passed by reference. Image is a class.
[QUOTE=Richy19;29239627]Why is it that everywhere i look it says java passes by value, yet in my program its passing an image by reference[/QUOTE]
The Java "reference" is passed by value. However, even though the reference is a copy of the original reference, the [i]object it "refers" to is still the same object[/i]:
[cpp]
void foo(Foo instance)
{
instance.x = 5; // change the object it points to
instance = null; // the local "instance" is null
}
Foo instance = new Foo();
foo(instance);
// our instance here is NOT null, but instance.x DOES equal 5
[/cpp]
[editline]17th April 2011[/editline]
[QUOTE=Richy19;29239943]
Shouldnt the image be a copy of img?
Only every time I call the constructor everything in the shot list changes[/QUOTE]
No, your local "image" reference still refers to the original image.
[highlight](User was permabanned for this post ("Bye null" - Overv))[/highlight]
[QUOTE=random.coder;29240073]
No, your local "image" reference still refers to the original image.[/QUOTE]
So to copy thevalue would i just do sometihing like
image = new Image(img);
I think the constructor allows you to do that
Why would you want to copy the image? It's bad to load the image multiple times into memory.
Unless I'm completely missing the point and image is just a metaphor then in that case completely ignore me.
[QUOTE=Richy19;29240188]So to copy thevalue would i just do sometihing like
image = new Image(img);
I think the constructor allows you to do that[/QUOTE]
Yup, exactly.
[editline]17th April 2011[/editline]
[QUOTE=iPope;29240499]Why would you want to copy the image?[/QUOTE]
To have a different rotation for each instance.
Images usually have a BitmapData object which they reference for the actual image data and when you do new Image(img) it probably just copies over the reference to that data so it isn't loaded twice.
[QUOTE=random.coder;29240073][highlight](User was permabanned for this post ("Bye null" - Overv))[/highlight][/QUOTE]
It looks like we have our very own Doug
[QUOTE=Darwin226;29240026]As I said. I think only types like int, float, double, bool (maybe string, not sure) are passed by value.
All the instances of classes get passed by reference. Image is a class.[/QUOTE]
Strings are reference types just like other classes. Java uses immutable, interned, copy-on-write strings.
[QUOTE=random.coder;29240073][highlight](User was permabanned for this post ("Bye null" - Overv))[/highlight][/QUOTE]
"Curses, how did they see through my disguise? Could it be the fact that I registered [i]moments after I was just banned[/i]? No, it couldn't be. Maybe it's because all of my posts were in the same thread I was just banned in?"
He also probably used the same IP. :rolleyes:
[QUOTE=random.coder;29240073][highlight](User was permabanned for this post ("Bye null" - Overv))[/highlight][/QUOTE]
Why does he get banned when he's helpful? IMO as long as he doesn't start arguments he should be allowed to stay.
[QUOTE=BlkDucky;29241555]"Curses, how did they see through my disguise? Could it be the fact that I registered [i]moments after I was just banned[/i]? No, it couldn't be. Maybe it's because all of my posts were in the same thread I was just banned in?"
He also probably used the same IP. :rolleyes:[/QUOTE]
Maybe he doesn't care all that much...?
[QUOTE=Robber;29241661]Why does he get banned when he's helpful? IMO as long as he doesn't start arguments he should be allowed to stay.[/QUOTE]
I would agree with this. Not sure if garry would, though. :v:
He [i]could[/i] stay, if he was a bit more subtle about it, but...
[QUOTE=BlkDucky;29241844]I would agree with this. Not sure if garry would, though. :v:
He [i]could[/i] stay, if he was a bit more subtle about it, but...[/QUOTE]
What actually happened with null? I think i came a bit late to the party :v:
It isn't enough for nullsquared to simply behave (which he hasn't managed to do in the past despite a multitude of chances), he must also be able to hide his identity, else it would only be inevitable for shit to start. I don't think he's capable of either of these conditions.
That's partly the fault of everyone interacting with him, but it's mostly his fault.
[QUOTE=Icedshot;29241860]What actually happened with null? I think i came a bit late to the party :v:[/QUOTE]
The story goes that he was working on something for garry and wanted a raise or the money upfront or all of the money when he had only done a couple of days work.
Garry then banned him for a week (or some period of time) and then he created a thread in the RC saying he didnt want to come back and that we would never forget him.
Apart from that he was always causing trouble in this section
I bet if you guys didn't try to call which person was Null you wouldn't mind him at all.
limittoinf who was supposedly null stuck here for some time. Also, he was nothing but helpful so I'd say that, if that was null, he can behave.
[QUOTE=Richy19;29241931]
Apart from that he was always causing trouble in this section[/QUOTE]
He's been causing heated arguments since even before the Programming forum (that means before custom forums).
He purposely posted in the RC asking to be banned. He therefore forfeited his account.
He was right though, we never did forget his name...
How can you forget a name like Agop...
When did nullsquared get banned? January 2009 ish?
About a year ago I was working on C++ got overwhelmed with school work and stopped. This year I have an hour of school so I may start up on C++ again. Wish me luck.
Sorry, you need to Log In to post a reply to this thread.