Skip to content

Add macros to support C++ Properties (like on C#) #850

Closed Answered by rh101
aismann asked this question in Q&A
Discussion options

You must be logged in to vote

Adding something like this would cause a lot more problems than it solves. It would also make debugging harder, as macros always do.

It's been done before in Cocos2d-x, and eventually their usage was removed. Just look at CCPlatformMacros.h, with an example being CC_PROPERTY:

#define CC_PROPERTY(varType, varName, funName) \
protected:                                     \
    varType varName;                           \
                                               \
public:                                        \
    virtual varType get##funName() const;      \
    virtual void set##funName(varType var);

If you search for CC_PROPERTY in the platform, you won't find any usage of it.

Pl…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@aismann
Comment options

aismann Sep 9, 2022
Collaborator Author

Answer selected by aismann
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants