In java and objective-c, a variable representing an object is generally a pointer to that object. However, it seems that in C++, it\'s common to have non-pointer types hold
When you pass an object to a function by value, it's copied by means of its class's copy constructor. If you haven't defined a copy constructor, there'll be a default one supplied by the compiler (unless you take special steps to avoid that), which is equivalent to copying the members by hand.
The preferred thing to do is often actually to pass a const reference rather than either a pointer or the object itself.
(You might want to be aware that actually a struct
is just a class
whose members are public
by default; in particular, structs can have user-defined copy constructors too. A struct is not necessarily just plain inert data.)