Greenhorn
Greenhorn

Reputation: 668

Use of new operator -compiled error C2661: 'CObject::operator new' : no overloaded function takes 4 arguments (Multiple Inheritance)

I have the below class in header file

class CodeListSqlGenerator : public ICodeListSqlGenerator,public CDialog


{
    ........
public:
CodeListSqlGenerator(IIntelligentCodeListUpgraderParameter *i_intelligent_codelist_upgrader_parameter);
}

When I use a new operator in .cpp file to create an object of type CodeListSqlGenerator

ICodeListSqlGenerator *CreateCodeListSqlGeneratorInterface(IIntelligentCodeListUpgraderParameter *i_intelligent_codelist_upgrader_parameter)
{
ICodeListSqlGenerator *i_codelist_sql_generator = new CodeListSqlGenerator(i_intelligent_codelist_upgrader_parameter);
return i_codelist_sql_generator;
}

I'm get getting the below when compiled error C2661: 'CObject::operator new' : no overloaded function takes 4 arguments How do I rectify this error? Thanks in advance -Athreya

Upvotes: 2

Views: 2147

Answers (2)

user736140
user736140

Reputation: 44

DEBUG_NEW macro has to be change,. check whether you have included preprocessor #undef new, Try to write the #undef new before the new keyword

Upvotes: 1

It looks like you are trying to create an ICodeListSqlGenerator object using the CodeListSqlGenerator constructor. This cannot be done, as ICodeListSqlGenerator already has its own constructor. However, a CodeListSqlGenerator object IS A ICodeListSqlGenerator, so you can create a CodeListSqlGenerator object and return the pointer to it as a ICodeListSqlGenerator pointer.

Upvotes: 0

Related Questions