Programming in C/C++ Efficiently
Course 'CS205 C/C++ Program Design' in 2021 Fall at Southern University of Science and Technology. The lecture videos can be found at https://www.bilibili.com/video/BV1Vf4y1P7pq
Chapter 1: Getting Started
Chapter 2: Data Types and Arithmetic Operators
Chapter 3: Loops and Branching Statements
Chapter 4: Data Structures
Chapter 5: Memory and Pointer
Chapter 6: Basics of Functions
Chapter 7: Advances in Functions
Chapter 8: Speedup Your Program
Chapter 9: Basics of Classes
Chapter 10: Advances in Classes
Chapter 11: Dynamic Memory Management in Classes
Some Default Operations
- Default constructor
- Copy constructor
- Assign operator
- Default destructor
- How pointer members work by default
An Example with Dynamic Data Allocation
Solution
Matrix Data Management in OpenCV
Lab
Create a class for matrices which elements are in float. The class should support the follow operations and has no memory management problem. When a matrix is assigned to another by =, the two matrices will share the same data.
class Matrix{...};
Matrix a(3,4);
Matrix b(3,4);
Matrix c = a + b;
Matrix d = a * 2.0f;
Chapter 12: Class Inheritance
Deriving a Class
- Constructor
- Destructor
Static and Dynamic Binding
Vitural Functions
Access Control (protected)
Dynamic Memory Management
Lab
Chapter 13: Class Templates and std Library
Defining a Class Template
Templates in OpenCV
Templates in std
Lab
Create a matrix template class which can handle different data types.
Chapter 14: Exceptions
Chapter 15: Friend Classes and Nested Classes
Reference
- Mr. Yitong Wang's repo for the course in Fall 2020. https://github.com/YeeTone/CS205-2020Fall