Let's say I have three very different classes with no common parent: Camera, Light, Model. But all three have the same generic SetPos(float x, float y, float z) method that translates their position in 3D space. I also have a reference list (e.g. std::map) that stores pointers to objects of all three classes of type void* - meaning it's generic and non-descript.
So to summarize: I have a bunch of cameras, lights and models with very different data structures that all can be moved around using SetPos method that each have and I keep generic, no-type void* pointers to all of them in a single map for quick access.
What I want to know is if it's possible to somehow call that SetPos from a void* without determining class object type (e.g. storing it in that std::map and then casting that void* to a proper class pointer using it)?
Is there some template idea for it?
Or should I just create a generic interface class that will have a pure virtual method SetPos(x,y,z) and simply make those three classes inherit from it - and be done with it by simply casting that pointer to that single class - but I'd rather avoid this option because... reasons and what if some alternative way is better?