Course program for 1st year students - no experience with OOP
Hi guys,
I'll be teaching relative newbies OOP in C++. They know some C++ but no OOP. Each lecture will be 3 hours. What do you think about the curriculum?
* **Introduction to OOP.** Review of pointers, references, and memory types in C++. Passing by value/reference. Procedural style vs. OOP – what OOP improves. Basic principles of OOP. Classes and objects at a high level. Structures in C++. Comparison of the basic principles with Java. Examples.
* **Abstraction and Encapsulation.** Access modifiers. Abstraction. Const classes and member functions. `mutable`. Streams and file input/output.
* **Constructors and Destructor.** The `this` pointer. Invocation of constructors and destructors. Converting constructors. Constructor and destructor calls when creating arrays (static and dynamic). The RAII principle.
* **Copy constructor and assignment operator (**`operator=`**).** Separate compilation. Preprocessor. Composition and aggregation. Examples – the `Student` class.
* **Move semantics** – benefits, lvalue, rvalue, move constructor/assignment operator, `std::move`. Example of a string class with move semantics (C++11). Arrays of pointers to objects.
* **Rule of Five and Rule of Zero.** Dynamic memory in classes. `default` / `delete` for special member functions (C++11). Example of a student class with a name (arbitrary length) and an array of grades (arbitrary length).
* **Operator overloading.** Friend classes and functions. Defaulted comparison operators and `<=>` (C++20). Example implementation of a complex number and an `Nvector`.
* **Error handling.** Static data members. Exceptions. Exception handling. Exception hierarchies and examples. Exceptions in constructors and destructors. Levels of exception safety. Modern approach – `std::expected` (C++23). Example of a class that counts its instances.
* **Relationships between objects.** Association. Dependencies. Ownership. Design guidelines.
* **Inheritance.** Types of inheritance. Function parameters (pointers and references). Constructors and destructors in inheritance. Copying in inheritance. Move semantics in inheritance. Example with a person, student, and teacher.
* **The** `virtual` **keyword.** Static and dynamic binding. Virtual functions. Keywords `override`, `final`. Virtual tables. Polymorphism – runtime and compile-time. Example.
* **Abstract classes and interfaces.** Pure virtual functions. Object slicing, type casts. Type erasure (`std::function`, C++11). Comparison with Java.
* **Multiple inheritance.** Diamond problem. Collections of objects in a polymorphic hierarchy. Copying and deletion. Example with the `Student` class.
* **Templates.** Required functions in a template class/template function. Template specializations. Examples of template classes/functions from the standard library. Smart pointers. Usage and idea of `shared_ptr`, `weak_ptr`, `unique_ptr` (C++11/14). Example of a stack (with template capacity) and a queue (with a `resize` function).
* **Design patterns.** SOLID principles. Pattern examples – Singleton, Factory, Prototype, Composite, Flyweight, Iterator, Command, Visitor, PIMPL – examples.
https://redd.it/1puugre
@r_cpp
Post #24565
14