Access Modifiers in C++

Pages : 3
Views : 274

Summary of Contents for Manual

Access Modifiers in C++

  • Page 1

    and unwanted side effects. A major problem in developing large programs is theaccidental changing of a variable's value because it was used elsewhere in the program.This can happen in C/C++ if you use too many global variables in your programs.Access ModifiersThere are two modifiers that control ...

  • Page 2

    void sp_to_dash(const char *str){while(*str) {if(*str== ' ') printf("%c", '-');else printf("%c", *str);str++;}}If you had written sp_to_dash()in such a way that the string would be modified, itwould not compile. For example, if you had coded sp_to_dash()as follows, you wouldre...

  • Page 3

    system. In this situation, the contents of the variable are altered without any explicitassignment statements in the program. This is important because most C/C++compilers automatically optimize certain expressions by assuming that a variable'scontent is unchanging if it does not occur on the lef...