Programming in C++ PDF
Programming in C++ PDF
By
Preface
Acknowledgement
4.1 Tokens
4.1.1 Keywords
4.1.2 Identifiers
4.1.3 Constants
4.2 Data Types
4.2.1 Basic Data Type
4.2.2 User defined data type
4.2.2.1 Structure
4.2.2.2 Union
4.2.2.2.1 Difference between Structure and Union
4.2.2.3 Enumeration
4.2.2.4 Class
4.2.3 Derived Data Types
4.2.4 Operators
4.2.4.1 Arithmetic Operators
4.2.4.2 Relational Operators
4.2.4.3 Logical Operators
4.2.4.4 Assignment Operators
4.2.4.5 Increment and Decrement Operators
4.2.4.6 Bitwise Operators
4.2.4.7 Conditional Operator
4.2.5 Scope Resolution Operator (::)
4.2.6 Member dereferencing operator
4.2.7 Memory Management Operators
4.2.7.1 New
4.2.7.2 Delete
4.2.8 Comma Operator
4.2.9 sizeof operator
4.3 Strings
4.4 Variables
4.5 Dynamic initialization of variables
4.6 Reference variables
4.7 Type Casting
4.7.1 Implicit conversion
4.7.2 Explicit conversion
4.8 Symbolic constants
4.8.1 const keyword
4.8.2 enum keyword
Summary
Review Questions
5.1 Expressions
5.1.1 Arithmetic Expressions
5.1.2 Relationnel Expressions
5.1.3 Logical Expressions
5.2 Evaluation of expressions
5.3 Precedence of arithmetic operators
5.4 Control Statements / Control Structure
5.4.1 Unconditional Statement
5.4.1.1 goto Statement
5.4.2 Decision – making statement
5.4.2.1Simple if statement
5.4.2.2 if…else Statement
5.4.2.3 Nested-if Statement
5.4.2.4 Switch Statement
5.4.3 Looping Statement/ Repetitive Statement
5.4.3.1 While loop
5.4.3.2 Do - while
5.4.3.3 for loop
5.4.4 Jump Statement
5.4.4.1 Break statement
5.4.4.2 Continue Statement
Summary
Review Questions
6.1 Pointers
6.1.1 Advantages
6.1.2 Pointer declaration
6.1.3 Declaring and initializing pointers
6.1.4 Pointer operators
6.2 Pointer Arithmetic
6.3 Pointers and Arrays
6.4 Pointers and Strings
6.5 Pointers to Pointers
6.6 Pointers and Structures
6.7 Pointers to classes
6.8 this pointer
6.9 Pointers to Derived Classes
6.10 Arrays
6.10.1 Characteristics of Arrays
6.10.2 Classification of Arrays
6.10.2.1 One dimensional array
6.10.2.2 Two dimensional arrays
6.10.2.3 Multidimensional arrays
6.11 Arrays of Pointers
6.12 Arrays of Structures
6.13 Arrays within a Structure
6.14 Array of Classes
Summary
Review Questions
Chapter 7 Functions
7.1 Functions
7.1.1 Main ( ) Function
7.1.2 Parts of Functions
7.1.2.1 Function prototype
7.1.2.2 Function Definition
7.1.2.3 Calling a function
7.2 Formal and Actual arguments
7.2.1 Formal arguments
7.2.2 Actual arguments/ Passing arguments
7.3 Return Statement
7.4 Storage classes
7.4.1 Type of Storage Classes
7.5 Call by Value
7.6 Call by reference / Pass by reference
7.7 Return by reference
7.8 Default argument
7.8.1 Rules for declaring default argument
7.9 Constant argument
7.10 Inline Functions
7.11 Recursion
7.12 Function Overloading
7.12.1 Using different number of parameters/arguments
7.12.2 Using different type of argument / parameters
7.13 Rules of Function Overloading
Summary
Review Questions
8.1 Class
8.1.1 Specifying a class
8.2 Access Specifiers / Visibility Modifiers/ Access Control
8.3 Creating objects
8.4 Accessing Class members
8.5 Defining Member Functions
8.5.1 Defining member Functions inside the class
8.5.2 Defining member functions outside the class
8.6 Nesting of member functions
8.7 Private member functions
8.8 Static Data Members
8.9 Static Member Function
8.9.1 Rules of Static Member function
8.10 Arrays of Object
8.11 Friend Function
8.11.1 Characteristics of friend functions
8.12 Bit Fields and Classes
8.12.1 Bit Fields
8.12.2 Classes
Summary
Review Questions
9.1 Constructors
9.2 Types of Constructor
9.2.1 Default Constructor
9.2.2 Parameterized Constructor
9.2.3 Copy Constructor
9.3 Dynamic Constructor
9.4 Default Arguments
9.5 Characteristics of Constructors
9.6 Constructors Overloading
9.7 Destructors
9.7.1Rules for destructor
Summary
Review Questions
Chapter 11 Inheritance
11.1 Inheritance
11.1.1 Rules of Inheritance
11.1.2 Advantages of inheritance
11.1.3 Disadvantages of inheritance
11.2 Defining derived classes
11.3 Types of Inheritance
11.3.1 Single Inheritance
11.3.2 Multilevel Inheritance
11.3.3 Multiple Inheritance
11.3.4 Hierarchical Inheritance
11.3.5 Hybrid Inheritance
Summary
Review Questions
Chapter 12 Polymorphism
12.1 Introduction
2.2 Polymorphism
12.3 Virtual Functions
12.3.1 Rules for Virtual Functions
12.4 Pure Virtual Function
12.5 Virtual Base Class
12.6 Abstract Class
12.7 Binding
Summary
Review Questions
Chapter 13 File Management / Working with Files in C++
13.1 Files
13.2 Stream
13.2.1 Text file
13.2.2 Binary file
13.3 Classes for file stream operation
13.4 File Operations
13.4.1 Opening and closing a file
13.4.2 Writing and reading a file
13.5 Detecting end of a file / End of file detection
13.6 File modes
13.7 File Pointers and their manipulations
13.7.1 Manipulation of file pointer using functions
13.8 Sequential input and output operations
13.9 Updating a file
13.10 Errors handling during file operations
13.11 Command line arguments
Summary
Review Questions
Chapter 14 Templates
14.1 Templates
14.2 Class Template
14.3 Class template with multiple Parameter
14.4 Function Template
14.5Function Template with multiple parameters
14.6 Overloading of function template
14.7 Member Function Template
14.8 Non-Type Template Arguments
Summary
Review Questions
Summary
Review Questions
APPENDIX C: Exercises