Skip to content
/ cpp06 Public

C++98 exercises on Explores scalar type conversions, serialization, and real type identification in C++. The exercises implement advanced castings and type manipulations in compliance with C++98 standards.

Notifications You must be signed in to change notification settings

raveriss/cpp06

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CPP06 - École 42 | Paris

Introduction

CPP06 focuses on type conversion and casting in C++. The exercises are designed to provide practical experience with different casting operators, ensuring a solid understanding of type conversion mechanisms in compliance with the C++98 standard.

Project Structure

This module consists of a series of exercises that explore various aspects of type conversion and serialization:

Exercise 00: Conversion of Scalar Types

  • Directory: ex00/
  • Files to submit:
    • incs/ScalarConverter.hpp
    • Makefile
    • srcs/main.cpp
    • srcs/ScalarConverter.cpp

Functionality

Introduces the ScalarConverter class, which contains a static method convert. This method takes a string representation of a C++ literal and outputs its value as char, int, float, and double. The class is non-instantiable and handles edge cases like non-displayable characters and pseudo literals.

Exercise 01: Serialization

  • Directory: ex01/
  • Files to submit:
    • incs/Data.hpp
    • incs/Serializer.hpp
    • Makefile
    • srcs/Data.cpp
    • srcs/main.cpp
    • srcs/Serializer.cpp

Functionality

Implements a Serializer class with static methods serialize and deserialize. The serialize method converts a pointer to an unsigned integer (uintptr_t), and the deserialize method converts it back to a pointer. The exercise includes creating a Data structure to test these methods.

Exercise 02: Identify Real Type

  • Directory: ex02/
  • Files to submit:
    • incs/A.hpp
    • incs/Base.hpp
    • incs/B.hpp
    • incs/C.hpp
    • incs/generate.hpp
    • incs/identify.hpp
    • Makefile
    • srcs/Base.cpp
    • srcs/generate.cpp
    • srcs/identify.cpp
    • srcs/main.cpp

Functionality

Implements a Base class with a public virtual destructor and three derived classes (A, B, and C). The exercise includes functions to generate a random instance of A, B, or C and identify the real type of an object pointed to by a Base pointer or reference, without using the typeinfo header.

Compilation and Execution

Navigate to the specific exercise directory and use the make command to compile the projects. Each executable can be run directly to demonstrate the functionalities implemented.

Ressources Utilisées

About

C++98 exercises on Explores scalar type conversions, serialization, and real type identification in C++. The exercises implement advanced castings and type manipulations in compliance with C++98 standards.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published