Single-Line Comments. McGraw-Hill The Complete Reference Fourth Edition
Annonce
Annonce
252
C + + : T h e C o m p l e t e R e f e r e n c e
Single-Line Comments
C++ (and C99) supports two types of comments. The first is the multiline comment.
The second is the single-line comment. Single-line comments begin with a // and end at the end of the line. For example,
// this is a single-line comment
Single line comments are especially useful when short, line-by-line descriptions are needed. Although they are not technically supported by C89, many C compilers will accept them anyway, and single-line comments were added to C by C99. One last point: a single-line comment can be nested within a multiline comment.
You should include comments whenever they are needed to explain the operation of the code. All but the most obvious functions should have a comment at the top that states what the function does, how it is called, and what it returns.
Part II
C
Part One examined the C subset of C++. Part Two describes those features of the language specific to C++. That is, it discusses those features of C++ that it does not have in common with C. Because many of the C++ features are designed to support object-oriented programming (OOP), Part Two also provides a discussion of its theory and merits. We will begin with an overview of C++.
Copyright © 2003 by The McGraw-Hill Companies. Click here for terms of use.
This page intentionally left blank
Chapter 11
An Overview of C++
Copyright © 2003 by The McGraw-Hill Companies. Click here for terms of use.
255
Download
Annonce