首页 > 编程语言 > 详细

我的C++库

时间:2021-06-19 15:17:48      阅读:26      评论:0      收藏:0      [点我收藏+]
  1. c++基类hpp文件
    • 包含GET_SET宏定义,用来生成get和set函数
#ifndef _MAJIAOOBJECT_H 
#define _MAJIAOOBJECT_H 

#include <string>
using namespace std; 

#define MAJIAO_FIELD_DEFINE(type, field) type field

#define GET_SET(access_permission, type, name)    access_permission:        MAJIAO_FIELD_DEFINE(type, name);    public:        inline void set##name(type v){            this->##name = v;        }        inline type get##name(){            return this->##name;        }

class MajiaoObject { 
    public :  
        GET_SET(public, int, id)

        MajiaoObject() {  } 
        ~MajiaoObject() {  } 

        virtual string toString() { return ""; }
} ; 
#endif	// _MAJIAOOBJECT_H

我的C++库

原文:https://www.cnblogs.com/majiao61/p/14902584.html

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