[Please do not mail me a copy of your followup]
Doug Mika <
doug...@gmail.com> spake the secret code
<
96d29439-79f4-430e...@googlegroups.com> thusly:
>I got the following line from my book:
>
>"ios_base::failure - thrown by the functions and methods in the iostream
>library."
>
>the question I have is, is there a difference between functions and
>methods in C++?
The standard library implements features through functions and classes
with methods.
Functions are not attached to an instance of an object and therefore
do not have a 'this' pointer. Functions can't see internal details of
a class (unless they are friends[*]). Functions are declared outside
of a class, but possibly within a namespace.
Methods are attached to an object and are declared within a class. If
the method is not a static method, then it has access to instance data
of the associated object on which it is invoked. If it is a static
method, then it has access to other static methods and data for that
class.
[*] My advice is to use friend as a last resort. There are times when
it is necessary but most of the time it is used to paper over a hole
in your design.
--
"The Direct3D Graphics Pipeline" free book <
http://tinyurl.com/d3d-pipeline>
The Computer Graphics Museum <
http://computergraphicsmuseum.org>
The Terminals Wiki <
http://terminals.classiccmp.org>
Legalize Adulthood! (my blog) <
http://legalizeadulthood.wordpress.com>