C++ Quick Syntax Reference

Book description

The C++ Quick Syntax Reference is a condensed code and syntax reference to the C++ programming language. It presents the essential C++ syntax in a well-organized format that can be used as a handy reference.

You won't find any technical jargon, bloated samples, drawn out history lessons, or witty stories in this book. What you will find is a language reference that is concise, to the point and highly accessible. The book is packed with useful information and is a must-have for any C++ programmer.

In the C++ Quick Syntax Reference, you will find:

  • A concise reference to the C++ language syntax.

  • Short, simple, and focused code examples.

  • A well laid out table of contents and a comprehensive index allowing easy review.

  • What you'll learn

  • How to create a C++ HelloWorld

  • How to Compile and Run

  • What are C++ Variables, Operators, Pointers and References

  • What are Arrays, Strings, Conditionals, Loops and more

  • How to do Functions

  • How to work with Constructors, Inheritance, Overridings

  • How to use Access Levels, Static, Enum, String and Union, and more

  • What are Custom Conversions, Namespaces, Constants, and Preprocessor

  • How to do Event Handling

  • What are Type Conversions, Templates, Headers, and more

  • Who this book is for

    This book is a quick, handy pocket syntax reference for experienced C++ programmers, and a concise, easily-digested introduction for other programmers new to C++.

    Table of contents

    1. Title Page
    2. Contents at a Glance
    3. Contents
    4. About the Author
    5. About the Technical Reviewer
    6. Introduction
    7. CHAPTER 1: Hello World
      1. Choosing an IDE
      2. Creating a project
      3. Adding a source file
      4. Hello world
      5. Using namespace
    8. CHAPTER 2: Compile and Run
      1. Visual Studio compilation
      2. Console compilation
      3. Comments
    9. CHAPTER 3: Variables
      1. Data types
      2. Declaring variables
      3. Assigning variables
      4. Octal and hexadecimal assignment
      5. Using variables
      6. Variable scope
      7. Default values
      8. Integer types
      9. Signed and unsigned integers
      10. Floating-point types
      11. Char type
      12. Bool type
    10. CHAPTER 4: Operators
      1. Arithmetic operators
      2. Assignment operators
      3. Combined assignment operators
      4. Increment and decrement operators
      5. Comparison operators
      6. Logical operators
      7. Bitwise operators
      8. Operator precedence
    11. CHAPTER 5: Pointers
      1. Creating pointers
      2. Dereferencing pointers
      3. Pointing to a pointer
      4. Dynamic allocation
      5. Null pointer
    12. CHAPTER 6: References
      1. Creating references
      2. References and pointers
      3. Reference and pointer guideline
    13. CHAPTER 7: Arrays
      1. Array declaration and allocation
      2. Array assignment
      3. Multi-dimensional arrays
      4. Dynamic arrays
      5. Determining array size
    14. CHAPTER 8: String
      1. String combining
      2. Escape characters
      3. String compare
      4. String functions
    15. CHAPTER 9: Conditionals
      1. If statement
      2. Switch statement
      3. Ternary operator
    16. CHAPTER 10: Loops
      1. While loop
      2. Do-while loop
      3. For loop
      4. Break and continue
      5. Goto statement
    17. CHAPTER 11: Functions
      1. Defining functions
      2. Calling functions
      3. Function parameters
      4. Default parameter values
      5. Function overloading
      6. Return statement
      7. Forward declaration
      8. Pass by value
      9. Pass by reference
      10. Pass by address
      11. Return by value, reference or address
      12. Inline functions
    18. CHAPTER 12: Class
      1. Class methods
      2. Inline methods
      3. Object creation
      4. Accessing object members
      5. Forward declaration
    19. CHAPTER 13: Constructor
      1. Constructor overloading
      2. This keyword
      3. Constructor initialization list
      4. Default constructor
      5. Destructor
      6. Direct initialization
      7. Value initialization
      8. Copy initialization
      9. New initialization
    20. CHAPTER 14: Inheritance
      1. Upcasting
      2. Downcasting
      3. Multiple inheritance
    21. CHAPTER 15: Overriding
      1. Hiding derived members
      2. Overriding derived members
      3. Base class scoping
      4. Calling base class constructor
    22. CHAPTER 16: Access Levels
      1. Private access
      2. Protected access
      3. Public access
      4. Access level guideline
      5. Friend classes and functions
      6. Public, protected and private inheritance
    23. CHAPTER 17: Static
      1. Static fields
      2. Static methods
      3. Static local variables
      4. Static global variables
    24. CHAPTER 18: Enum
      1. Enum example
      2. Enum constant values
      3. Enum conversions
      4. Enum scope
    25. CHAPTER 19: Struct and Union
      1. Struct
      2. Declarator list
      3. Aggregate initialization
      4. Union
      5. Anonymous union
    26. CHAPTER 20: Operator Overloading
      1. Operator overloading example
      2. Binary operator overloading
      3. Unary operator overloading
      4. Overloadable operators
    27. CHAPTER 21: Custom Conversions
      1. Implicit conversion methods
      2. Explicit conversion methods
    28. CHAPTER 22: Namespaces
      1. Accessing namespace members
      2. Nesting namespaces
      3. Importing namespaces
      4. Namespace member import
      5. Namespace alias
      6. Type alias
      7. Including namespace members
    29. CHAPTER 23: Constants
      1. Constant variables
      2. Constant pointers
      3. Constant references
      4. Constant objects
      5. Constant methods
      6. Constant return type and parameters
      7. Constant fields
      8. Constant guideline
    30. CHAPTER 24: Preprocessor
      1. Including source files
      2. Defining macros
      3. Undefining macros
      4. Macro functions
      5. Line-break
      6. Avoid using macros
      7. Conditional compilation directives
      8. Compile if defined
      9. Error directive
      10. Line directive
      11. Pragma directive
    31. CHAPTER 25: Exception Handling
      1. Throwing exceptions
      2. Try-catch statement
      3. Re-throwing exceptions
      4. Exception specification
      5. Exception class
    32. CHAPTER 26: Type Conversions
      1. Implicit conversions
      2. Explicit conversions
      3. Static cast
      4. Reinterpret cast
      5. Const cast
      6. C-style and new-style casts
      7. Dynamic cast
      8. Dynamic cast examples
      9. Dynamic or static cast
    33. CHAPTER 27: Templates
      1. Function templates
      2. Calling function templates
      3. Multiple template parameters
      4. Class templates
      5. Non-type parameters
      6. Default types and values
      7. Class template specialization
      8. Function template specialization
    34. CHAPTER 28: Headers
      1. Why to use headers
      2. Using headers
      3. What to include in headers
      4. Include guards
    35. Index

    Product information

    • Title: C++ Quick Syntax Reference
    • Author(s):
    • Release date: July 2013
    • Publisher(s): Apress
    • ISBN: 9781430262770