Please don't top-post. Replies are either interspersed
or appended to the original post. -- rearrranged.
An example is as follows:
void f(int x)
{
x++;
};
This is a great function that doesn't do anything.
Since the variable 'x' is passed by value, the
function is incrementing a _copy_ of the variable,
not the original variable. Also, it doesn't return
any value.
Perhaps you want something like this:
void f(int &x) // pass by reference
{
x++; // Now it modifies the original variable.
} // No need for a semicolon, ';', here.
class Int
{
public:
Int() { val = 0; }
private:
int val;
};
One could easily have used:
typedef int Int;
int main()
{
int (x);
Int(y);
I believe you want:
int x;
Int y;
Remember, f(x) doesn't modify its argument.
See above.
Remember that C++ is a case-sensitive language.
The identifiers 'Book' and 'book' are different.
This is perfectly legal:
class Book {};
Book book;
However, this kind of style is frowned upon since there
is greater chance to confuse the reader.
--
Thomas Matthews
C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq:
http://www.parashift.com/c++-faq-lite
C Faq:
http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book
http://www.sgi.com/tech/stl -- Standard Template Library