简体   繁体   中英

trouble compiling source code

I am porting some code from Gcc to visual c 6 but i got some error while compiling this code

XMLNode::XMLNode( const string & _name, const string & _value ) :
    XMLAbstractNode::XMLAbstractNode( _name, xml_node ),
    value( _value )
{// No code here.
}

it compiles on mingw gcc code blocks but get follwing error when compiling on visual c 6 it gives follwing error

error C2436 member function or nested class in constructor initializer list

what is meaning of abobe code as begiiner to c++ XMLNODE is drived class calling parent class constructor XMLABSTRACTNode with parameters .but wht is , value(_value) here how to compile code on vc6

I think VC 6 complains about the initialization of the super class. Try the following code (replace the doubled class name XMLAbstractNode::XMLAbstractNode with just XMLAbstractNode ):

XMLNode::XMLNode( const string & _name, const string & _value ) :
    XMLAbstractNode( _name, xml_node ),
    value( _value )
{
    // No code here.
}

The code value(_value) just initializes the member variable value with the passed string _value .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM