After using C # for the last ten or two years, my C ++ is a little rusty.
If I have the following:
class CBase
{
public:
CBase(LPCTSTR pszArg1, LPCTSTR pszArg2, LPCTSTR pszArg3);
virtual ~CBase();
};
class CDerived : CBase
{
};
I can't seem to create an instance CDerived.
no constructor instance "CDerived :: CDerived" matches the argument list
I know that I can explicitly create a derived constructor:
CDerived::CDerived(LPCTSTR pszArg1, LPCTSTR pszArg2, LPCTSTR pszArg3)
: CBase(pszArg1, pszArg2, pszArg3)
{
}
But this seems like a lot of typing, especially if I plan to derive many classes from the base class.
The base class still needs such arguments anyway. Is there a way to not overwrite these arguments for each derived class, perhaps by “exposing” the base constructor, or should I always do everything I did above?