B
barcaroller
What is the common way/design-pattern (if any) in C++ for delegating
function calls that are not handled by a certain class. Public
inheritance would be one way but not all classes are meant to inherit
from (e.g. STL).
Example:
class A
{
public:
foo();
private:
set<string> myset;
}
A myObj;
myObj.insert(); // compiler error of course
Is there some mechanism (direct or indirect) where a function that is
not handled by myObj gets delegated to another object (e.g. myset)?
function calls that are not handled by a certain class. Public
inheritance would be one way but not all classes are meant to inherit
from (e.g. STL).
Example:
class A
{
public:
foo();
private:
set<string> myset;
}
A myObj;
myObj.insert(); // compiler error of course
Is there some mechanism (direct or indirect) where a function that is
not handled by myObj gets delegated to another object (e.g. myset)?