Welcome to the CppInsights repository, your go-to destination for unraveling the mysteries of C++ programming. Here, we've meticulously curated examples that elucidate fundamental concepts and rules of C++, presented in an accessible manner.
Organized into branches, each section of this repository is dedicated to a specific aspect of C++, facilitating easy navigation and focused learning. Whether you're a novice or an experienced developer, our examples are tailored to help you grasp complex concepts and refine your C++ skills.
Inspired by Dr. Frank Mitropolous's esteemed Udemy course on C++, we've distilled the essence of his teachings into this repository, making it an invaluable resource for learners of all levels.
Accompanied by detailed explanations in the README file, each branch serves as a guided tour through the realm of C++, empowering you to unlock the language's full potential and embark on a rewarding programming journey. Join us as we delve into the depths of C++, one concept at a time. Happy coding!
-
Computers execute commands given by programmers, who write programs in languages like C++, each with its own rules. Programs are translated from high-level human-readable code to low-level instructions by compilers, with files linked together to form an executable. Errors are common in programming, and understanding them is crucial for effective troubleshooting:
- Compiler Errors
- Linker Errors
- Runtime Errors
- Logic Errors
-
We will explore the structure of a C++ program, which consists of a series of instructions that are executed sequentially. The program consists of multiple types of instructions that shape its structure, we will cover the following:
- Preprocessor Directives
- Comments
main()
Function- Namespaces
- Basic Input/Output
-
Variables and constants are used to store data in a program, with variables being mutable and constants being immutable. We will cover the following:
- Variable Declaration
- Variable Initialization
- Variables Types
- Constants
-
Arrays and vectors are used to store multiple values of the same type in a single variable. We will cover the following:
- Arrays
- Vectors
- Multidimensional Arrays & Vectors
-
Statements and operators are used to perform operations on data in a program. We will cover the following:
- Statements
- Expressions
- Operators
- Operator Precedence
- Compound Assignment Operators
-
Controlling program flow is essential for executing specific instructions based on conditions. We will cover the following:
- Block Statements
- Variable Scope
- Selection Statements
if
Statementsif-else
Statements- ... and more
- Iteration Statements
for
loopswhile
loops- ... and more
-
Characters and strings are used to represent textual data in a program. We will cover the following:
- Characters
- Strings
- C-Style Strings
- C++ Strings
-
Functions are used to encapsulate a set of instructions that perform a specific task. We will cover the following:
- Function Definition
- Function Prototypes
- Function Parameters
- Return Statements
- Default Arguments
- Overloading Functions
- Passing Arrays to Functions
- Passing by Reference
- Scope Rules
- How Functions Work
- Inline Functions
-
Pointers and references are used to store memory addresses and access data indirectly. We will cover the following:
- Pointer Declaration & Initialization
- Accessing Pointers & Storing Addresses
- Dereferencing Pointers
- Dynamic Memory Allocation
- Relationship Between Pointers & Arrays
- Pointer Arithmetic
- Constants & Pointers
- Pointers & Functions
- Potiential Pointer Pitfalls
-
Object-Oriented Programming (OOP) is a programming paradigm that uses objects to model real-world entities. We will cover the following:
- What is Object-Oriented Programming?
- What are Classes & Objects?
- Declaring Classes and creating Objects
- Accessing Class Members
- Public & Private Access Specifiers
- Implementing Class Functions
- Constructors & Destructors
- Constructor initializer lists
- Delegating Constructors
- Constructor parameters with default values
- Copy Constructor
- Move Constructor
- The
this
Pointer - Static Class Members & Functions
- Structs vs Classes
- Friend Functions & Classes
-
Operator overloading allows operators to be redefined for user-defined types. We will cover the following:
- Why operator overloading?
- Overloading the assignment operator (Copy)
- Overloading the assignment operator (Move)
- Overloading operators as Member Functions
- Overloading operators as Global Functions
- Overloading the stream insertion and extraction operators
-
Inheritance is a mechanism that allows a class to inherit properties and behaviors from another class. We will cover the following:
- Key Concepts in Inheritance
- Inheritance vs Composition
- Deriving class from existing class
- Protected Members and Class Access
- Access Control Table
- Constructors and Destructors in Inheritance
- Passing Arguments to Base Class Constructors
- Copy/Move Constructors and Assignment Operators in Inheritance
- Redefining Base Methods
- Multiple Inheritance
-
Polymorphism is a feature that allows objects to be treated as instances of their parent class. We will cover the following:
- What is Polymorphism?
- Static vs Dynamic Polymorphism
- Base Class Pointers or References
- Virtual Functions
- Virtual Destructor
override
keywordfinal
keyword- Pure Virtual & Abstract Classes