Archived

This topic is now archived and is closed to further replies.

Geoff the Medio

inline / const function declaration

Recommended Posts

Does the order in which keywords appears in a function definition make any difference? ie. what''s the effect of switching between: inline int const getWidth() { return width; }; inline int getWidth() const { return width; }; const inline int getWidth() { return width; }; or any other valid orderings?

Share this post


Link to post
Share on other sites
Well,
inline int getWidth() const;
means that the ''this'' pointer is const, and so the function does not change the object. However, the other two mean that the return value is a const int.

Share this post


Link to post
Share on other sites