Complete C++ Programming Reference
Complete C++ Reference's
C++ Language — Developed by Bjarne Stroustrup in 1983 as an extension of C. Combines procedural and object-oriented programming.
Intro Of C++ Language
C++ is a powerful, high-performance programming language developed by Bjarne Stroustrup in 1983 as an extension of the C language. It combines the features of procedural and object-oriented programming, making it highly suitable for large-scale applications such as system/software development, game engines, real-time simulations, and embedded systems. Due to its performance and flexibility, C++ remains a foundational language in modern software development.
Why C++ Matters? Used in game development (Unreal Engine), operating systems, browsers, and high-frequency trading systems.
Basic C++ Program Structure
#include <iostream>
using namespace std;
int main() {
cout << "Hello, C++!" << endl;
return 0;
}
Key Differences from C:
iostream instead of stdio.h
cout for output instead of printf
endl for newline
- Object-oriented features (classes, objects)
1. C++ Keywords
| Keyword | Description |
| auto | Deduces type automatically |
| bool | Boolean data type |
| break | Exit from loop or switch |
| case | Label in a switch statement |
| catch | Handles exceptions |
| char | Character data type |
| class | Declares a class |
| const | Declares a constant |
| continue | Skips current loop iteration |
| default | Default label in switch |
| delete | Deallocates memory |
| do | Starts do-while loop |
| double | Double precision float |
| else | Else branch of if-statement |
| enum | Declares enumeration |
| explicit | Used to avoid implicit conversions |
| export | Used for exporting templates |
| extern | Declares external linkage |
| false | Boolean false value |
| float | Floating point data type |
| for | Loop structure |
| friend | Grants access to private members |
| goto | Jumps to labeled statement |
| if | Conditional branch |
| inline | Suggests inlining function |
| int | Integer data type |
| long | Long integer |
| mutable | Allows member to be modified in const obj |
| namespace | Encapsulates identifiers |
| new | Allocates memory |
| operator | Overloads operator |
| private | Private access specifier |
| protected | Protected access specifier |
| public | Public access specifier |
| register | Registers variable (hint) |
| reinterpret_cast | Casts pointer to different type |
| return | Returns from a function |
| short | Short integer |
| signed | Signed modifier |
| sizeof | Returns size in bytes |
| static | Static lifetime |
| struct | Declares structure |
| switch | Multi-way branch |
| template | Declares templates |
| this | Pointer to current object |
| throw | Throws exception |
| true | Boolean true value |
| try | Starts exception handler |
| typedef | Creates alias for type |
| typeid | Returns type information |
| typename | Indicates type name in templates |
| union | Declares union |
| unsigned | Unsigned modifier |
| using | Imports names from namespace |
| virtual | Declares virtual function |
| void | No return value or type |
| volatile | Prevents optimization |
| wchar_t | Wide character type |
| while | Loop with condition at top |
| static_cast | Performs explicit conversion |
| dynamic_cast | Safely casts in polymorphic class hierarchy |
2. C++ Data Types
| Type | Description |
| int | Integer |
| char | Character |
| float | Floating point |
| double | Double precision float |
| bool | Boolean (true/false) |
| void | No value |
| wchar_t | Wide character |
| short | Short integer |
| long | Long integer |
| unsigned | Positive-only integer variants |
// Data type examples
int age = 25;
float price = 99.99f;
double pi = 3.14159265359;
bool isDone = true;
char grade = 'A';
wchar_t wideChar = L'न';
3. C++ Operators
| Operator Type | Operators |
| Arithmetic | + - * / % |
| Assignment | = += -= *= /= %= |
| Increment/Decrement | ++ -- |
| Comparison | == != > < >= <= |
| Logical | && || ! |
| Bitwise | & | ^ ~ << >> |
| Compound Assignment | &= |= ^= <<= >>= |
| Ternary | ? : |
| Scope Resolution | :: |
| Member Access | . -> |
| Pointer | * & |
| Type Cast | static_cast, dynamic_cast, const_cast, reinterpret_cast |
Scope Resolution (::)
Access global variables, namespace members, or static class members
Type Casting
static_cast, dynamic_cast, const_cast, reinterpret_cast
Member Access
. for direct, -> for pointer member access
4. Modifiers
| Modifier | Description |
| signed | Can hold negative and positive |
| unsigned | Only positive values |
| short | Reduces memory usage |
| long | Extends memory size |
5. Control Structures
| Structure | Description |
| if / else | Conditional logic |
| switch | Multi-case logic |
| for | Loop with init-condition-update |
| while | Entry-controlled loop |
| do...while | Exit-controlled loop |
| break | Exit loop/switch |
| continue | Skip current iteration |
| goto | Jumps to labeled location |
| return | Exits function |
6. Preprocessor Directives
| Directive | Use |
| #include | Include header files |
| #define | Define macros |
| #undef | Undefine macros |
| #ifdef | If defined |
| #ifndef | If not defined |
| #endif | Ends conditional directive |
| #if / #else | Conditional compilation |
| #pragma | Special compiler instructions |
| #error | Throws compilation error |
| #line | Changes line number for errors |
7. Special Symbols & Characters
| Symbol | Meaning |
| { } | Block of code |
| [ ] | Array brackets |
| ( ) | Function call or grouping |
| ; | Statement terminator |
| " " | String literal |
| ' ' | Character literal |
| \\ | Escape character |
| // | Single-line comment |
| /* */ | Multi-line comment |
C++ OOP Features:
- Classes & Objects — Blueprint and instances
- Inheritance — Reuse and extend classes
- Polymorphism — Virtual functions, overloading
- Encapsulation — Private/protected members
- Abstraction — Abstract classes, interfaces
Back to Notes Page