关于类型转换

[复制链接]
 楼主| dfsa 发表于 2012-3-22 18:20 | 显示全部楼层 |阅读模式
一个解析xml文件的类,里面很多这样的函数定义

const TiXmlNode* LastChild( const
char
* value ) const;            /// The last child of this node matching 'value'. Will be null if there are no children.

TiXmlNode
* LastChild( const
char
* _value ) {
        
return const_cast< TiXmlNode*
> ((const_cast<
const TiXmlNode*
>(this))->LastChild( _value ));
    }

定义一个const函数 和一个非const函数的意义是什么,在第二个函数中使用const_cast转换的意义又是什么
您需要登录后才可以回帖 登录 | 注册

本版积分规则

282

主题

2404

帖子

2

粉丝
快速回复 在线客服 返回列表 返回顶部