If you can rely on C++11, a simple way can be
class CText: public string
{
public:
template<class... T>
CText(T&&... t) :string(forward<T>(t)...)
{}
...
};
Essentially the constructor is based on a varadic template (taking form 0 to whatever number of argument of whatever types) that are taking in term of r-value reference (think to it as a relaxed
const&
, that can also take and modify temporary values) and forwarded (in C++0x a
&&
becomes a
&
when passed as argument:
forward
, just casts it back to
&&
) one-to-one to the base class.
As a result, until there is a constructor in string that takes certain parameters, They can be taken by the superclass as well.