Skip to content

pranavdm99/enpm702_fall2024

 
 

Repository files navigation

Lecture 1: Course Introduction

This lecture provides an overview of the course, guides you through setting up Visual Studio Code, and demonstrates the proper way to retrieve lecture materials from Github.

The following software MUST be installed for the first course:

  • A GitHub account with an SSH key configured is essential. You must follow along, and I can't stress enough how important it is to have a GitHub account with an SSH key set up.
  • Visual Studio Code.

Lecture 2: Code Blocks

This lecture provides an overview of the course, guides you through setting up Visual Studio Code, and demonstrates the proper way to retrieve lecture materials from Github.

The following software MUST be installed for this lecture:

  • A GitHub account with an SSH key configured is essential. You must follow along, and I can't stress enough how important it is to have a GitHub account with an SSH key set up.
  • Visual Studio Code.

Reading Material

The reading material covers basic types, selections, and iterations.

Lecture 3: Pointers

This lecture provides an in-depth discussion on pointers, references, memory allocation, and related C++ concepts. Here is a summarized overview:

  • Valgrind:

    • Introduction to Valgrind, its setup, and its use for detecting memory leaks, profiling, and concurrency bugs.
  • Memory Allocation:

    • Explanation of memory allocation on the stack and heap.
    • Static memory, automatic memory allocation (stack), and dynamic memory allocation (heap) are discussed.
  • Pointers:

    • Concepts such as pointer declaration, initialization, and the indirection operator (*).
    • Covers pointer arithmetic, typed pointers, and the importance of const-correctness in pointers.
    • Includes practical examples to demonstrate pointer behavior.
  • Dynamic Memory Allocation:

    • Usage of new and delete operators for dynamic memory management.
    • Common issues with raw pointers such as memory leaks, wild pointers, dangling pointers, and double deletion.
  • References:

    • Discusses the characteristics of references, their safety compared to pointers, and practical use cases.
    • Highlights differences between pointers and references.

Lecture 4: The C++ Standard Library - Containers

This lecture provides an in-depth discussion for the following containers from the C++ Standard Library.

  • std::string
  • std::array
  • std::vector

Lecture 5: Functions

This lecture covers C++ functions, including:

  • Declaration, definition, and usage
  • Argument passing methods: value, reference, const-reference, pointer
  • Return types: value and reference
  • Benefits: modularity, reusability, debugging
  • Advanced topics:
    • Function overloading
    • Default arguments
    • Stack frames
    • Recursion
    • main() function structure

Practical exercises reinforce these concepts, preparing for the upcoming smart pointers lecture.

Lecture 6: Smart Pointers

Overview of smart pointers:

  • Unique pointers
  • Shared pointers
  • Weak pointers

Lecture 7: OOP (Part 1)

This lecture covers the design and implementation phases of OOP, including class design, method definitions, access specifiers, constructors, destructors, and static attributes and methods. It also includes several code examples and exercises, guiding students through creating and managing objects, accessing attributes, and implementing OOP principles in C++. The document highlights best practices and common conventions used in C++ programming.

Lecture 8: OOP (Part 2)

This lecture focuses on advanced concepts in object-oriented programming (OOP). The lecture covers several important topics:

  • Exception Handling: Detailed explanations of how to manage runtime errors using try, catch, and throw in C++. It includes examples of basic exception handling, throwing exceptions, catching exceptions, and handling multiple exceptions. The key terms such as "throwing an exception" and "catching an exception" are discussed with code examples.

  • Relationships in OOP:

    • Association: A type of relationship between two classes where one class is aware of the other. Different kinds of associations are explained, including directional, unidirectional, and bidirectional associations.
    • Aggregation: A whole-part relationship where the part can exist independently of the whole.
    • Composition: A stronger form of association where the part cannot exist independently of the whole and is destroyed when the whole is destroyed.
    • Inheritance: The concept of inheritance is thoroughly discussed, including generalization-specialization relationships, inheritance specifiers (public, protected, private), and how constructors work in the context of inheritance. The lecture provides examples and tasks for students to work on, focusing on implementing derived classes like GasolineVehicle and ElectricVehicle.

Lecture 9: OOP (Part 3)

my_vscode_files

This folder contains my custom .vscode files. Students are free to reuse them.

About

Central repository for C++ and ROS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 99.3%
  • CMake 0.7%