Sam's is not the best course to take in C++...
Beware of always/never rules. They are usually wrong.
Classes (not
instances or
objects, mind you) should generally be declared outside of functions.
1 2 3 4 5 6 7 8 9 10
|
class fooey
{
...
};
int main()
{
fooey foo; // here we create an instance of the class: an object
...
}
|
Generally speaking, you should avoid using global variables/objects unless you have a very good reason to do so.
I do not know the context of the quote, so I cannot comment much on it. I think he is making a reference to how an object is accessed - this is the concept of
encapsulation, which is part of OO.
The purpose of an object is to
abstract and
encapsulate its internal properties. An example would be the STL iostreams. You have the standard streams, which read and write to the console. You have file streams, which read and write with disk files. You have sockets, strings, etc. But in all cases, all you need to know to use them is
astream << "Hello";
Keep in mind that the
way you use them may be specific to the type of stream it is, but the mechanics of using it is the same across all streams.
Hope this helps.
[edit] Good grief, I type slow... [/edit]