It sounds like what you are looking for is a form of an object request broker. Provide the name of a class as a string (or, if the set of desired objects is more constrained, an integer or enum or something similar) and then build an instance based on that key. Generally, all these objects typically inherit from some base class like Object so that the broker can return an Object* and the client can dynamic cast it down to the actual thing. I've used a pattern like this in the past that worked pretty well using macro magic to enable classes eligible to be instantiated through the broker (register the key and the class name with the broker). This was pre-C++03, so doubtless there are cleaner and more modern ways to implement such a thing these days.
lobsticle
joined 2 years ago
Actually, these are fucking great. Super outsidery. I'd buy but want to make sure the kids get the bulk of the profits, not the teacher.
Hello, casual football follower here. It looked like the ball took a deflection off the leg of a Man U player. Would this not be considered an own goal? Appreciate the insight!
As an old Perl jockey, you can pry my backticks out of my cold, dead hands.