Which language are we talking here? Cpp? Because typeof hasn't ever seemed useful to me in how I use cpp or how I have ever really used a language. I also remember it being criticized in java class more than 20 years ago when OOP was solely preached, even for scientific people like me.
This sure looks like C#. I use typeof every once in a while when I want to check that the type of a reference is a specific type and not a parent or derived type. But yea, really not that often.
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.