-2

i am trying to overload the + operator due to this error:

tools.cpp(147) : error C2679: binary '+' : no operator found which takes a right-hand operand of type 'CSchemaString' (or there is no acceptable conversion)

The code is:

// I TRIED THIS TO OVERLOAD + OPERATOR
CSchemaString operator +(const CVisuComm& CVisuComm::TabCCUImess, 
                         const CSchemaString&       GetPriority);

//THE CODE AT WHICH THE ERROR IS RETURNED, 
//error C2679: binary '+' : no operator found which takes 
//a right-hand operand of type 
//'CSchemaString' (or there is no acceptable conversion)
CVisuComm::TabCCUImess[CVisuComm::nbCCUImess++]=
                        "RECONFIGURATION SOLUTION N° " +config.GetPriority();

//THE VARIOUS TYPES ARE
//CVisuComm-------class CVisuComm
//TabCCUImess-----static CString 
//nbCCUImess------static int nbCCUImess
//config----------CConfig_State_ChangeType 
//GetPriority-----CSchemaString

but it throws the same error along with

error C2751: 'CVisuComm::TabCCUImess' : the name of a function parameter cannot be qualified

So please suggest the correct way to overload the operator. Any help is appreciated.

4

1 に答える 1

0

2 番目のエラー メッセージからヒントが得られます。the name of a function parameter cannot be qualified

最初のパラメーター名は名前にする必要があります。現時点では、クラス名で修飾されています。

それ以外の:const CVisuComm& CVisuComm::TabCCUImess

多分それはあるべきです:const CVisuComm& Comm

于 2012-08-18T17:33:06.053 に答える