I am still quite new on here so I hope I am posting in right forum.
I am currently writing a small library where I realized I could use some kind of design pattern which lets one pass constructor arguments to initialization or allocation functions, and these can be further specialized in inherited classes.
Something like this:
class MyArgs{
// basically just a wrapper/container
// just a constructor and variables
// everything public or friend of MyClassBase
};
class MyClassBase{
MyClassBase(MyArgs a){
doAllocation(a);
doInitialization(a);
}
//... defining default doAllocation() and doInitialization() ...
};
class MyClassDerived : public MyClassBase{
MyClassDerived(MyArgs a) : MyClassBase(a){}
//... override doAllocation() and doInitialization() ...
};
Does there exist some kind of design pattern which makes this easier?
