Untitled
unknown
plain_text
4 years ago
1.4 kB
11
Indexable
#pragma once
#include "driving_licence.h"
#include <iostream>
#include <string>
using namespace std::string_view_literals;
class InternationalDrivingLicence {
public:
operator DrivingLicence()
{
return DrivingLicence();
}
InternationalDrivingLicence() {
((DrivingLicence*)this)->dMethod = (void (DrivingLicence::*)()const)&InternationalDrivingLicence::PrintID;
((DrivingLicence*)this)->ddel = (void (DrivingLicence::*)())&InternationalDrivingLicence::Delete;
std::cout << "InternationalDrivingLicence::Ctor()"sv << std::endl;
}
InternationalDrivingLicence(const InternationalDrivingLicence& other)
{
DrivingLicence id(reinterpret_cast<const DrivingLicence&>(other));
((DrivingLicence*)this)->dMethod = (void (DrivingLicence::*)()const)&InternationalDrivingLicence::PrintID;
((DrivingLicence*)this)->ddel = (void (DrivingLicence::*)())&InternationalDrivingLicence::Delete;
std::cout << "InternationalDrivingLicence::CCtor()"sv << std::endl;
}
~InternationalDrivingLicence() {
std::cout << "InternationalDrivingLicence::Dtor()"sv << std::endl;
}
void PrintID() const {
std::cout << "InternationalDrivingLicence::PrintID() : "sv << ((IdentityDocument*)this)->GetID() << std::endl;
}
void Delete()
{
delete this;
}
};Editor is loading...