Hallo,
I have a few questions I have been wondering about:
In the function "void foo(const int)", what does the const do? I get how it is usefull if the value is passed as a reference, but when its not i dont understand what the const do.
Is there a difference between void foo(int *a) and void foo(int &a)?
At university, they teach us to always make all class variables private. Is this really a good idea? I see that is is useful is some cases (say, addMoney() to change the balance a bank account class).
The last question is from a slide for a class in not taking( so I did not get the anware, just the question)
How can you make a function that turns 1 into 0 and 0 into 1? Without using if statements.
Regards,
Ole Kristian