
1. Core C++ Language
Constructors and Virtual Functions
Why can’t constructors be declared as virtual functions?
Can static functions be virtual functions?
The role of explicit and its usage scenarios.
Memory Management
The difference between new and malloc (type safety, constructor calls)
Strategies to avoid dangling pointers and memory leaks
The size of an empty class and the default generated functions (constructor/destructor/copy, etc.).
In-depth keyword exploration
The four forms of const modifying pointers (int const* vs int* const)
Application scenarios of volatile (interrupt shared variables, hardware registers)
The role of static in local/global variables and functions.
Object-Oriented Programming
The mechanism of the virtual function table (vtable)
Definition of pure virtual functions and abstract classes
Performance differences between move constructors and copy constructors.
2. Memory and Resource Management
Dynamic Memory Operations
Vector expansion mechanism (2x expansion, resize vs reserve)
Performance differences between push_back() and emplace_back()
Usage scenarios of smart pointers (unique_ptr/shared_ptr).
Data Storage and Access
Memory alignment rules for structures and unions (struct/union)
Applications and limitations of bit-fields
Implementation of endianness judgment program.
3. Multithreading and Concurrency
Thread Control
Thread states (ready/running/blocked) and types of thread locks (mutex/read-write lock)
Thread synchronization methods (semaphore/condition variable/atomic operations)
Differences between optimistic and pessimistic locking.
Resource Competition
Causes of race conditions
Prevention and detection of deadlocks
Conditions for implementing lock-free programming.
4. Hardware and System Interaction
Hardware Association
Usage of volatile in register mapping
Constraints on writing interrupt service routines (ISR) (non-blocking, short duration)
Bit manipulation techniques (setting/clearing specific bits).
Communication Protocols
Four operating modes of SPI (CPOL/CPHA)
Start/stop conditions and conflict arbitration of I²C
Baud rate and frame format configuration of UART.
5. STL and Templates
Container Characteristics
Performance differences between map (red-black tree implementation) and unordered_map (hash table implementation)
Methods for resolving hash collisions (open addressing/chaining)
Iterator invalidation scenarios (e.g., during vector insertion).
Modern C++
Implementation principles of perfect forwarding (std::forward)
Capture methods of lambda expressions (value capture vs reference capture lifecycle risks)
Underlying implementation of move semantics (rvalue reference conversion).
This article is an original piece by Wanyi Education, please indicate the source when reprinting!