This module explores C++ type conversions, casting, reinterpretation, and dynamic type identification using virtual functions.
For each exercise, navigate to its folder, compile, and run:
π ex00
cd ex00
make
./convert
π ex01
cd ex01
make
./serializer
π ex02
cd ex02
make
./downcast
ex00 β Conversion of scalar types: Implement a ScalarConverter class to detect and convert a string literal into char, int, float, and double. Handle pseudo-literals like nan, +inf, -inf.
ex01 β Serialization: Implement a Serializer class with static methods serialize() and deserialize() to convert a pointer to an integer and back. Test with a Data structure.
ex02 β Identify real type: Create a Base class with derived A, B, C. Implement functions to randomly generate instances and identify their type at runtime using dynamic casting (no typeinfo).
If you have any questions or suggestions, feel free to connect: π LinkedIn: Valentina Nguyen πββοΈ
This project was developed and tested on Linux (Ubuntu).