vs2013怎么快速生成C++类成员变量的get,set函数, 类似eclipse的功能
PHPz
PHPz 2017-04-17 11:56:42
0
3
722

vs2013怎么快速生成类成员变量的get,set函数, 类似eclipse的功能

PHPz
PHPz

学习是最好的投资!

reply all(3)
小葫芦

You can check this out at http://my.oschina.net/fjxy/blog/72106

阿神

I remember that C# in vs uses ctr+r+e to quickly generate attributes for fields. As for c++, it seems that the syntax is not necessary.

左手右手慢动作

I have not found this function.
It is possible to use Qt Creator, move the cursor to the member variable, and then use the shortcut Alt + Enter and the option will appear.
If there are many member variables to be defined in VS, you can use the class wizard function to create a class.
If you don’t mind it, you can use the following macro definition

#ifndef MEM_GET_SET
#define MEM_GET_SET(member,member_type) \
    member_type get_##member(){return member;}
    void set_member(member_type value){ this->member = value;}

endif

Use as follows

class A
{
public:
    MEM_GET_SET(a,int)
private:
int a;
};
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!