-1

inline unsigned int FunctionName() const { return variable; }

I recently came across inline functions, and i wanted to know what const is actually doing in this snippet of code.

Cyborg
  • 41
  • 2

1 Answers1

0

Actually this is an method and inline is optional here. Const mean the this method do not change something in the struct/class. Also it mean that you can use it on const version of this struct/class.

struct my_stuff {
    int variable;

    inline int FunctionName() const { return variable; }
}
DevO
  • 365
  • 1
  • 8