Sams Teach Yourself C in 21 Days

(singke) #1
The C++ Programming Language 661

BD2


Summary ............................................................................................................


Today, you covered the basics of C++ programming. More specifically, you learned
which operators and keywords are a part of C++, but are not a part of the C language.
These operators and keywords make up the building blocks of C++. In tomorrow’s les-
son, you’ll learn how to start building the core part of a C++ program—a class.

FIGUREB2.1
Inline functions verses
regular functions. int main( )
{
func( );
...
func( );
...
}
inline func( ) {// func code}

ORIGINAL

int main( )
{
func( );
...
func( );
...
}

func( )
{
// ...
}

Without inline specifier

int main( )
{
{
// func code
}
...
{
// func code
}
...
}

With inline specifier

COMPILED

Specifying a function as inline does not guarantee that it will actually be
Caution inline. This is only a request to the compiler.

You should keep inline functions small and concise. If a function is more
Tip than a line or two of code, it probably should not be inline.

37 448201x-Bonus2 8/13/02 11:18 AM Page 661

Free download pdf