/CPP

Lecture notes, projects and other materials for Course 'CS205 C/C++ Program Design' at Southern University of Science and Technology.

Primary LanguageC++OtherNOASSERTION

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 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

  1. Mr. Yitong Wang's repo for the course in Fall 2020. https://github.com/YeeTone/CS205-2020Fall