582
With PieMixin (lemmy.world)
submitted 11 months ago by mod_pp@lemmy.world to c/programmerhumor@lemmy.ml
you are viewing a single comment's thread
view the rest of the comments
[-] r00ty@kbin.life 3 points 11 months ago

Yeah in C# it has quite a few uses.

I'm working on a background fun project where there's a base class that is for olde style CPU emulation. Where you can derive a class from the base class and essentially design 8bit style CPUs.

I have a separate class as a generic Assembler that will work with any of the created CPUs. But, to be able to do that I need to be able to get information about instructions, arguments, opcodes, registers etc from the derived class.

So the assembler is instantiated with Assembler\ and then it uses typeof to instantiate the actual CPU class being used to get all the information.

So, that's just an example of when you'd use something like this.

this post was submitted on 28 Nov 2023
582 points (97.5% liked)

Programmer Humor

32443 readers
860 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS