--- /dev/null
+#include "Data.h"
+#include <iostream>
+
+Data::Data()
+ : m_i1(0)
+ , m_i2(0)
+{
+}
+
+Data::Data(int first, int second)
+ : m_i1(first)
+ , m_i2(second)
+{
+}
+
+Data::Data(const Data &other)
+{
+ *this = other;
+}
+
+Data::~Data()
+{
+}
+
+Data &Data::operator=(const Data &other)
+{
+ if (this == &other)
+ return (*this);
+ m_i1 = other.m_i1;
+ m_i2 = other.m_i2;
+ return (*this);
+}
+
+void Data::printAddress() const
+{
+ std::cout << this << '\n';
+}
+
+void Data::printData() const
+{
+ std::cout
+ << "m_i1 = " << m_i1 << '\n'
+ << "m_i2 = " << m_i2 << '\n'
+ ;
+}
--- /dev/null
+#ifndef DATA_H
+# define DATA_H
+
+class Data
+{
+ private:
+ int m_i1;
+ int m_i2;
+
+ public:
+ Data();
+ Data(int first, int second);
+ Data(const Data &other);
+ ~Data();
+
+ Data &operator=(const Data &other);
+
+ void printAddress() const;
+ void printData() const;
+};
+
+#endif // DATA_H
--- /dev/null
+CC := c++
+CFLAGS = -std=c++98 -Wall -Wextra -Werror -Wpedantic
+
+ifneq ("$(wildcard .debug)","")
+ CFLAGS += -g
+endif
+
+RM := rm -f
+
+INCDIR := inc
+INCDIR += $(addsuffix /inc, $(SUBPROJECTS));
+ifneq ($(INCLUDE),)
+ INCLUDE := $(addprefix -I, $(INCDIR))
+endif
+
+SRCDIR := .
+
+SOURCES := main.cpp \
+ Data.cpp \
+ Serializer.cpp \
+
+SOURCES := $(addprefix $(SRCDIR)/, $(SOURCES))
+
+OBJECTS := $(SOURCES:.cpp=.o)
+
+NAME := serialize
+
+all : $(NAME)
+
+debug : .debug
+ $(MAKE) all
+
+nodebug :
+ $(RM) .debug
+ $(MAKE) re
+
+.% :
+ $(MAKE) fclean
+ touch $@
+
+$(NAME) : $(OBJECTS)
+ $(CC) $(CFLAGS) -o $@ $^ $(LINKS)
+
+%.o : %.cpp
+ $(CC) $(CFLAGS) -o $@ -c $< $(INCLUDE)
+
+clean :
+ $(RM) $(OBJECTS)
+
+fclean : clean
+ $(RM) $(NAME)
+
+re : fclean
+ $(MAKE) all
--- /dev/null
+#include "Serializer.h"
+
+Serializer::Serializer()
+{
+}
+
+Serializer::Serializer(const Serializer &other)
+{
+ *this = other;
+}
+
+Serializer::~Serializer()
+{
+}
+
+Serializer &Serializer::operator=(const Serializer &other)
+{
+ if (this == &other)
+ return (*this);
+ return (*this);
+}
+
+uintptr_t Serializer::serialize(Data *ptr)
+{
+ return (reinterpret_cast<uintptr_t>(ptr));
+}
+
+Data *Serializer::deserialize(uintptr_t raw)
+{
+ return (reinterpret_cast<Data*>(raw));
+}
--- /dev/null
+#ifndef SERIALIZER_H
+# define SERIALIZER_H
+
+# include "Data.h"
+# include <stdint.h>
+
+class Serializer
+{
+ private:
+ Serializer();
+ Serializer(const Serializer &other);
+ ~Serializer();
+
+ Serializer &operator=(const Serializer &other);
+
+ public:
+ static uintptr_t serialize(Data *ptr);
+ static Data *deserialize(uintptr_t raw);
+};
+
+#endif // SERIALIZER_H
--- /dev/null
+#include "Data.h"
+#include "Serializer.h"
+#include <iostream>
+#include <stdint.h>
+
+int main()
+{
+ Data d1(1, 3);
+ Data d2(-2, 5);
+ Data *d1_ptr;
+ uintptr_t d1_raw;
+
+ std::cout << "With objects:\n\n";
+ d1.printAddress();
+ d1.printData();
+ d2.printAddress();
+ d2.printData();
+ std::cout << "\nRaw value of d1: ";
+ d1_raw = Serializer::serialize(&d1);
+ std::cout << std::hex << d1_raw << "\n\n";
+ std::cout << "Deserialized d1:\n\n";
+ d1_ptr = Serializer::deserialize(d1_raw);
+ d1_ptr->printAddress();
+ d1_ptr->printData();
+ return (0);
+}