• What are you working on? v16
    5,004 replies, posted
How to use it. I need to do some deep cloning.
[QUOTE=ZenX2;28213030]I don't really get interfaces. How would I use ICloneable?[/QUOTE] IIRC ICloneable allows you to make a copy of that object without it being a reference to it (haven't used it, so I'm not all too sure) interfaces are essentially things that mark a class's ability to do certain tasks or have certain features. A commonly used example is with animals. You can have a goldfish class, a human class, and a dog class. The interfaces you can use are ISwim, IWalk, ISelfAware. The goldfish class can only implement ISwim, because it's the only animal that can swim. the human can only implement IWalk and ISelfAware because it can't swim. The dog can only walk, so it'll implement IWalk only. Now let's say you wanted all the animals that could walk to start walking somewhere in your program. As long as they implement IWalk, you can simply run currentAnimal.Walk(); and it'll walk in it's own way (human on 2 legs, dog on 4) because they all implemented IWalk in a different way. To bring it back to the more commonly used interfaces, if you want your class to be cloneable, you would implement ICloneable, if you wanted your class to be serializable, you would implement ISerializable. It'll take a bit of experience to get the idea down fully. [editline]22nd February 2011[/editline] hmm, well it seems I got ninja'd there... meh make sure every object reference inside of your ICloneable object is also cloneable, have it return clones of everything underneath?
Implement it if you were inheriting a class. class Asd : ICloneable { ... } or if you're already inheriting Asd from another class or interface (call it "Ancestor"): class Asd : Ancestor, ICloneable { ... } There's probably a way to auto-implement all the methods etc. in the interface in all decent IDEs, by right-clicking the ICloneable or something
Why can't there be an animal version of :iiaca:? :ninja:
ITurnLeft? it would seem pretty dangerous to have a car class that DOESN'T implement ITurnLeft...
Ah. I assumed that it would actually give my class the ability to be cloned.
[QUOTE=Chris220;28213357]Why can't there be an animal version of :iiaca:? :ninja:[/QUOTE] There would be too many exceptions. If that is even a valid question and not just an excuse to use that image.
[QUOTE=ZenX2;28213557]Ah. I assumed that it would actually give my class the ability to be cloned.[/QUOTE] Well an interface sorta does do that. It's just that different classes often need different implementations of functions. Interfaces are useful in clearly defining what you have to do to make your class fulfill a certain specification. Most of the time, interfaces only require you to do a highly streamlined customization routine, and once it implements the interface, can be used in conjunction with other functions and classes that provide methods for handling that interface.
I went to Manchester Museum Of Science and Industry earlier today, and I'm going again on Friday. They're having a computing week and it's been awesome so far. I'll see what I can do about getting a recording of this Alan Turing drama type thing... It's really good, although I felt he could explain Binary a little better. If anybody else is free on Friday feel free to PM me, I'd love to meet up with some of you guys and... Well... Geek out?
[QUOTE=Dotmister;28213598]There would be too many exceptions. If that is even a valid question and not just an excuse to use that image.[/QUOTE] Eheh... of course it is *tugs at collar* Of course!
[QUOTE=Rocket;28215398]Does anyone know where I can get the PSP Toolchain? Or how I can get the svn url with WebSVN?[/QUOTE] No...
[QUOTE=Overv;28208707]Perhaps I'll start writing a guide to non-deprecated OpenGL on Windows today. I think it should also have a wiki-like system, so that people can correct it and add to it. It should cover everything from getting a window and context to compute shaders. Good idea?[/QUOTE] Yes!
Perlin noise is decent for height maps isn't it? I'm toying with the idea of making random worlds (probably pretty basic) for my roguelike, though it's probably harder than I think it is.
[QUOTE=Rocket;28215398]Does anyone know where I can get the PSP Toolchain? Or how I can get the svn url with WebSVN?[/QUOTE] [url]http://www.jetdrone.com/post/1/20/minpspw-0.11-is-out-for-windows-linux-and-mac[/url] This guy provides a modified, prepackaged PSP toolchain. I highly recommend it, or say DevPSP (which is extremely out of date).
[QUOTE=BlkDucky;28216772]Perlin noise is decent for height maps isn't it? I'm toying with the idea of making random worlds (probably pretty basic) for my roguelike, though it's probably harder than I think it is.[/QUOTE] Perlin noise is just tooo... random and unnatural. You're better off with fractal generation.
[QUOTE=q3k;28216889]Perlin noise is just tooo... random and unnatural. You're better off with fractal generation.[/QUOTE] Alright, thanks. Do you know of any good tutorials? I can find a ton on perlin noise but not many on fractal.
[QUOTE=BlkDucky;28216997]Alright, thanks. Do you know of any good tutorials? I can find a ton on perlin noise but not many on fractal.[/QUOTE] Fractal Generation is a lot harder... I took the maths behind it and added it to C#, I can see if I still have the code (I doubt it because I upped to 1TB not so long back) Also, this might help... [url]http://www.gameprogrammer.com/fractal.html[/url]
[media]http://imgur.com/fqqbo.png[/media] wat failing hard.
How do you make Resharper not delete both () when you delete one? I have been looking for the setting but I can't find it :\.
Sometimes regex makes me want to tear my hair out. I can generally get a pattern to work in python because of how energetically I can develop with it, but it still seems pretty temperamental and hard to intuit what might be causing it to not match. Anyways, that's not my problem; the problem I'm having is that after building some working patterns in python, I dropped them into my java app and every last one of them fails. It's not a backslash escaping problem before you ask, as I didn't use r"" with these in python. And I have got a rather lengthy expression already working in java for something else. [editline]22nd February 2011[/editline] Wow nevermind, built the url incorrectly in the java version...
What do you guys think to hosting a Programming conference where we can all show off our work... It'll be free.
will there be refreshments
After looking at event hire prices it may not be free, but it won't be expensive...
not going to happen...
[i]So, after discussing the various the logistics and costs associated with a conference, WAYWO users resolved instead to paint a big-ish "FP Programmers" on drawball 2[/i]
[QUOTE=Loli;28217541]What do you guys think to hosting a Programming conference where we can all show off our work... It'll be free.[/QUOTE] It'll be awkward.. if anyone shows up at all.
I agree with Overv, but I must admit it'd be pretty awesome to see some of you guys IRL. Shame we're all scattered over the globe
It would be interesting to say the least... I was thinking of just renting out a bar. Casual event where anybody could show anything...
[QUOTE=Loli;28218167]It would be interesting to say the least... I was thinking of just renting out a bar. Casual event where anybody could show anything...[/QUOTE] A bar with lots and lots of computers.
oh, i get, so it's just a gathering of people from the internet in a bar, with the intent to show things to each other and just generally have a good time i'm in
Sorry, you need to Log In to post a reply to this thread.