首页 > 其他 > 详细

构造函数、重载例子

时间:2017-02-19 17:09:55      阅读:210      评论:0      收藏:0      [点我收藏+]
技术分享
struct ListNode{  
    int val, add;  
    ListNode*next;  
    ListNode() :val(0), add(0), next(NULL){};  //构造函数
    ListNode(int x) :val(x), add(0), next(NULL){};  //函数重载
};  
View Code

 

技术分享
typedef struct Node  
{  
    int curAdress, key, nextAdress;  
    bool exist;  
    Node(){exist = false;}   //构造函数
    bool operator < (const Node& orh) const  //排序时会默认按照该方式(小于即升序)
    {  
        return key < orh.key;  
    }  
}Node; 
View Code

 

构造函数、重载例子

原文:http://www.cnblogs.com/wuxiaotianC/p/6416132.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!