Say, I declare my C++ class (used in Visual Studio 2008) as such:
enum FLAGS{
FLAG1 = 0x1
};
//.h
class CMyClass
{
public:
CRecycleBinOps(FLAGS flags);
private:
FLAGS _flags;
};
and then the implementation:
//.cpp
CMyClass::CMyClass(FLAGS flags) :
_flags(flags)
{
//Only this constructor is acceptable
}
When I try to allocate an array of my CMyClass:
CMyClass* pArr = new (std::nothrow) CMyClass[n];
It gives me the following error because I'm not passing the input parameter to the class:
error C2512: 'CMyClass' : no appropriate default constructor available
So how do I pass the parameter in that form?