C++ Study Notes
C++ Primer
C++ Primer is a classic C++ book. Studying it helps build a deeper understanding of C++. Since computer graphics depends heavily on C++, I started learning from this book and recorded notes here.

Chapter 15
Inheritance access modifiers: public, protected, and private.
public: all access permissions of base-class members remain unchanged in the derived class.
protected: all public members of the base class become protected members in the derived class.
private: all base-class members, whether public, protected, or private, become private members in the derived class.
In short, the access changes are shown below:
| Inheritance modifier | Base public | Base protected | Base private |
|---|---|---|---|
| public | public | protected | private |
| protected | protected | protected | private |
| private | private | private | private |
Chapter 17: Special Library Facilities
Regular Expressions: A 30-Minute Tutorial
Code Repository
C++ Related
Inspecting OOP Memory Layout
Visual Studio’s cl tool can conveniently inspect the memory layout of a class.
Using Visual Studio 2022 as an example:
Find this in the Start menu:
Visual Studio 2022 -> x64 Native Tools Command Prompt for VS 2022
Switch to the current directory. If you need to switch drives, such as to drive D, enter D: first. Then run:
cl /d1 reportSingleClassLayoutXXX [filename]
Here XXX is the class name, and [filename] is the source file.
For example, if the class name is Milk and the file is decorator.cpp:
cl /d1 reportSingleClassLayoutMilk decorator.cpp
Then you can see the layout result for class Milk:

When a class has virtual functions, a vtable pointer is inserted at the beginning of the class. With multiple inheritance, each inherited base adds one.