f(int i) declaration, f(const int i) definition?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dean

    #1

    f(int i) declaration, f(const int i) definition?

    We were working through one of Sutter's books this lunch time, and it
    came about that you can put a function:

    void f(int i); // in the header file

    and

    void f(const int i) {} // as the definition.

    My question is: is that correct? Isn't the type const int different
    from just int? I presume that inside function f, one could not change
    i if it's marked as const in the declaration, even if its marked so
    ONLY in the declaration.

    -Thanks for reading!
    -Dean
Working...