In C ++, using classes, we define a hierarchy of objects. Initializing the members of the derived class, we create an object. Question: How can I create a hierarchy of functions? Initializing the members that we would create a specific function instance. That is, the same code works in both overloaded and template functions. I also need to smear the code itself across the hierarchy, as we smear the data into classes, thus creating a multitude of entities of different levels of abstraction.

  • one
    But how can I clarify the problem? and it is too abstract it sounds. - KoVadim
  • one
    And how does the hierarchy of functions differ from the hierarchy of classes? Define a virtual operator () in your class hierarchy, that's all. (Yes, formally this is not a function, but a functor, but what's the difference?) - VladD
  • Usually creating an instance of a class, we create a list of data. Is there anything that allowed to create a list of procedures? - oasistravels
  • And what prevents to make a list (or other container) of abstract structures, each of which contains a function handle (of course, including the actual function pointer). - avp
  • Of course you can, but in general I would like to use language elements to make it easier to organize the hierarchy. For example: sort a (b); calls the constructor of the sort class, which, by taking the argument b, would initialize the members of the sort class and thereby create an object function a. - oasistravels

0