This system, which is also found in game engines, allows you to add multiple components to objects and modify the object through those components. It is an adequate system to start with and is written in a safe way to avoid memory leaks. You can develop this system according to yourself.
There are two examples in "main.cpp" to test the system. You can have an idea about the system through these examples.
Tested according to C++20 Standards.