Jump to content

Predict the Next Person to Post


Gyaradoskiller

Recommended Posts

I think in C# they are called generics. They basically let you create functions and classes that work with any type. For example:

template <typename T>

void swap (T & a, T & b )

{

T c = a;

a = b;

b = c;

}

So now you can use the swap function for ints, floats, strings and basically any type that is copy constructible and assignable. You can also create generizñc containers like the std::list<T>.

Spine?

Edited by Lugruf
Link to comment
Share on other sites

I...haven't watched any TV shows for a long time now. The occasional episode of something on Youtube, but that's it.

...yeah, my life's kind of "eh" right now beyond video games, and even there I've kind of stalled out a bit beyond the few I'm playing right now.

Lugruf?

Link to comment
Share on other sites

So sorry, no.

Quota tomorrow is to trim down this Geography essay to ~500 words (from 617) and revise for a Biology test. That's quite doable, I think.

Micky?

P.S. Did anyone notice the slightly Halloween-ified avatar? I might make it more obvious, add more grey and white to the scales.

Edited by Spineblade
Link to comment
Share on other sites

I thought it looked like you changed the eye color. Good thing I know I'm not crazy.

Also spine, you could also look into using delegates. They let you assign a definition to a function during runtime (you can add multiple). So for instance, you have delegate Swap. You would do Swap += baseClass.Swap. Then anytime you call the delegate Swap, it will call baseClass.Swap automatically, until you remove it from the delegate or clear the delegate out. I usually just clear the delegate because I like resetting it for each scene.

Lugruf?

Link to comment
Share on other sites

Btw spine, I think you can use print("Mumbo Jumbo") to the same effect.

BMIC, your first lesson is data types. int is for all integers (so no decimals), float is for decimals. Then there are byte sizes for numbers. A byte contains 8 bits and can store a number between 0-255 if it doesn't accept negative numbers, and -128 up to 127 if it does (0 is on the positive side, hence the lower 127). Then you have stuff like short, long, long long, which lets you store much more precise value ranges with numerous bytes. I've never needed these so I don't know them off the top of my head. The differences are for those who need to meticulously manage memory. So now you know why you see a number get capped at 255 in some games. The highest number that can be held in an int is 2 ^ 31 - 1 because that's the limit of a 32-bit system. Since we're moving into a standard of 64-bit systems, you'll see the limit go to 2 ^ 63 - 1 in the future, except old games likely won't due to legacy issues.

Is that a good start BMIC?

Link to comment
Share on other sites

Anstane, I tried sleeping but couldn't multiple times so I'm kinda screwed at this point, my body love 12 hour naps unfortunately

And dragon I could probably try and understand it but my head is fried at the moment so I'll get back to you on that, also keep in mind I have 0 experience :|

Dragon-sensei?

Link to comment
Share on other sites

Also spine, you could also look into using delegates. They let you assign a definition to a function during runtime (you can add multiple). So for instance, you have delegate Swap. You would do Swap += baseClass.Swap. Then anytime you call the delegate Swap, it will call baseClass.Swap automatically, until you remove it from the delegate or clear the delegate out. I usually just clear the delegate because I like resetting it for each scene.

That sounds inefficient. Remember tgat static binding is always better for performance than dynamic binding. So, unless you are programming for a very specific device with very little RAM like an arduino or a Commodore 64 or something like that, the code bloat of the templates is preferable to the runtime binding of delegates and function pointers.

Dragon?

Link to comment
Share on other sites

Anstane, I tried sleeping but couldn't multiple times so I'm kinda screwed at this point, my body love 12 hour naps unfortunately

I've always slept ~8-10 hours, so I'm used to that. If you're used to sleeping 12+ hours, well, that could be more of a problem.

And if you're looking to get into coding, then there are plenty of tutorials, on Youtube and on the net.

Lugruf?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...