Next: Dynamische Allokation
Up: Pointer Puzzles
Previous: Call by Reference I
void func(const int &locint)
{
cout << locint << endl;
locint=7;
}
main()
{
int i=3;
func(i);
cout << i << endl;
}
| Programm ist falsch, da die Zuweisung ungueltig ist. |
| Compiler: |
assignment of read-only reference `const int & locint' |
| © 1997 Gottfried Rudorfer, C++-AG, Lehrveranstaltungen, Abteilung für Angewandte Informatik, Wirtschaftsuniversität Wien, 3/19/1998 |