I'm trying to get better at writing C++ code and wanted to know if something like this is possible:
I have 256 instructions in an instruction set. They all have completely different behaviour but with common properties, so I thought about making 256 specific classes that would inherit a common class called Instruction. Then I'd like to store a constructor (or, even, a pair of constructors) for each class into an array of size 256 and simply create the instructions by doing something like: Instruction instr = constructorsOPCode;
Is that possible and is that a good way to approach this problem?