How to override a CC_SYNTHESIZE parameter?

Hi there,
as I told, I don’t understand how can I override a CC_SYNTHESIZE. I want to remove a warning on this line.

CC_SYNTHESIZE(int , idObject, IdObject);

WARNING:
‘getIdObject’ overrides a member function but is not marked ‘override’
‘setIdObject’ overrides a member function but is not marked ‘override’

How can I resolve this? thank you for reading

It’s a warning though…

Without knowing what you are doing and why I suppose you can Mark that function with override but I can’t comment on if that is wise without more explanation.

If you’re trying to override the methods created by the CC_SYNTHESIZE macro, then you’ll either need to declare them as you normally would, or create your own macro that has the override specifier.

So, either something like this (IMHO it’s the best way, since it’s clearer):

   int getIdObject() const override { // your implementation }
   void setIdObject(int var) override { // your implementation }

or

#define CC_SYNTHESIZE_OVERRIDE(varType, varName, funName)\
protected: varType varName; public: inline varType get##funName() const override { return varName; } inline void set##funName(varType var) override { varName = var; }
2 Likes