Skip to content

MuOssama/MasteringCPP

Repository files navigation

MasteringCPP

This repo is for Mastering C++ and Modern C++ Book

Topics

C++ Topics

Basic Syntax and Structure

  • What's Programming language
  • First program
    • Compilation Hello World
  • Variables and Data Types
    • Primitive types: int, char, float, double, bool
    • Derived types: arrays, pointers, references
    • User-defined types: structs, enums, classes
  • Operators and Expressions
    • Arithmetic operators: +, -, *, /, %
    • Relational operators: ==, !=, >, <, >=, <=
    • Logical operators: &&, ||, !
    • Bitwise operators: &, |, ^, ~, <<, >>
    • Assignment operators: =, +=, -=, *=, /=, %=, &=, |=, ^=, <<=, >>=
    • unary operators (Increment and decrement): ++, --
    • ternary operator: ?:
  • Control Structures
    • Conditional statements: if, if-else, nested if, switch-case
    • Looping statements: for, for range, while, do-while
    • Jump statements: break, continue, goto, return

Pointers and Memory Management

  • Introduction to Pointers
    • Pointer declaration, initialization, and dereferencing
    • Operations on Pointers
    • References and reference variables
  • Dynamic Memory Allocation
    • new and delete operators
    • Allocating memory for single variables and arrays
    • Linked List
    • Memory leaks and how to avoid them
  • Smart Pointers
    • std::unique_ptr
    • std::shared_ptr
    • std::weak_ptr

Functions

  • Function Declaration and Definition
    • Syntax: return_type function_name(parameters)
    • Function prototypes
    • Default arguments
  • Overloading and Inline Functions
    • Function overloading
    • Inline functions
  • Recursive Functions
    • Base case and recursive case
    • Examples: factorial, Fibonacci sequence
  • Parameter Passing
    • Pass-by-value
    • Pass-by-reference
    • Pass-by-pointer
  • Final project Linked List
    • Append element
    • Insert element
    • Delete element
    • Print element

Preprocessor Directives

  • Macros
    • #define, #undef
    • Function-like Macro
  • Conditional Compilation
    • #ifdef, #ifndef, #if, #else, #elif, #endif
    • Conditional compilation directives
  • File Guards

Compilation Process

  • Preprocessing
  • Compilation
  • Assembly
  • Linking
  • Compiling many source files

Object-Oriented Programming (OOP)

  • Classes and Objects
    • Class definition and declaration
    • Access specifiers: public, private, protected
    • Member variables and member functions
    • Object instantiation
  • Constructors and Destructors
    • Default constructor
    • Parameterized constructor
    • Copy constructor
    • Destructor
  • Inheritance
    • Base and derived classes
    • Types of inheritance: single, multiple, multilevel, hierarchical, hybrid
    • Constructor and destructor calls in inheritance
  • Polymorphism
    • Compile-time polymorphism: function overloading, operator overloading
    • Runtime polymorphism: virtual functions, pure virtual functions, abstract classes
  • Encapsulation
    • Data hiding
    • Setter and Getter (Accessor and mutator functions)
  • Abstraction
    • Abstract classes and interfaces
    • Virtual function and pure virtual function
  • Operator Overloading
    • Overloading unary and binary operators
    • Overloading operators using member and friend functions
  • Static Members
    • Static member variables and functions
    • Class-level data and behavior
  • Multiple Inheritance
    • Diamond problem and virtual inheritance
  • Operator Overloading
    • unary Overloading
    • binary Overloading
    • extraction and insertion Overloading
  • Rules
    • Rule of Three
  • Final project Tic-Tac-Toe

Templates

  • Function Templates
    • Template syntax and usage
    • Specialization of function templates
  • Class Templates
    • Template classes
    • Specialization of class templates

Standard Template Library (STL)

  • Containers
    • Sequence containers: vector, list, deque, array
    • Associative containers: set, map, multiset, multimap
    • Unordered containers: unordered_set, unordered_map, unordered_multiset, unordered_multimap
    • Container adaptors: stack, queue, priority_queue
  • Iterators
    • Input, output, forward, bidirectional, random access iterators
    • Iterator functions: begin(), end(), rbegin(), rend()
  • Algorithms
    • Non-modifying: find, count, equal, search
    • Modifying: copy, transform, swap, fill, replace, remove, unique
    • Sorting and searching: sort, stable_sort, partial_sort, nth_element, binary_search, lower_bound, upper_bound, equal_range
  • Function Objects
    • Functors and their usage
    • Predefined function objects in <functional>

Exception Handling

  • try, catch, throw
    • Syntax and usage
    • Multiple catch blocks
    • Catching all exceptions
  • Standard Exceptions
    • Hierarchy of standard exceptions
    • Defining custom exceptions

File I/O

  • Streams
    • Input/output stream classes: ifstream, ofstream, fstream
    • Input/output operations
  • File Operations
    • Opening, closing files
    • Reading from and writing to files
    • Binary file operations

Multithreading and Concurrency

  • Thread Management
    • Creating and managing threads
    • Joining and detaching threads
  • Mutexes and Locks
    • Mutual exclusion with std::mutex
    • Locking mechanisms: std::lock_guard, std::unique_lock
  • Condition Variables
    • Synchronization with std::condition_variable

Others

  • Using and Defining Namespaces

    • Defining a namespace
    • Using a namespace
    • Nested namespaces
  • Lambda Expressions

    • Basic lambda syntax
    • Capturing variables by value and reference
    • Lambda with parameters and return type

Modern C++ (C++11 to C++20)

C++11

  1. Range-Based for Loop
  2. Lambda Expressions
  3. Smart Pointers
  4. Rvalue References and Move Semantics
  5. Static Assertions
  6. Variadic Templates
  7. nullptr Keyword
  8. Strongly-Typed Enums
  9. Thread Support Library
  10. Chrono Library
  11. New Standard Libraries

C++14

  1. Generic Lambdas
  2. Return Type Deduction
  3. Relaxed constexpr Restrictions
  4. Binary Literals

C++17

  1. std::optional
  2. std::variant
  3. std::any
  4. Structured Bindings
  5. if constexpr
  6. Inline Variables
  7. Filesystem Library

C++20

  1. Ranges
  2. Modules
  3. New Standard Libraries

About

this repo is for Mastering C++ and Modern C++ Book

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages