Untitled
unknown
plain_text
4 years ago
1.2 kB
19
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()
{
vtable = new DrivingLicence();
this->vMethod = &InternationalDrivingLicence::PrintID;
this->del = &InternationalDrivingLicence::Delete;
std::cout << "InternationalDrivingLicence::Ctor()"sv << std::endl;
}
InternationalDrivingLicence(const InternationalDrivingLicence& other)
{
DrivingLicence a(*other.vtable);
std::cout << "InternationalDrivingLicence::CCtor()"sv << std::endl;
}
~InternationalDrivingLicence()
{
std::cout << "InternationalDrivingLicence::Dtor()"sv << std::endl;
delete vtable;
}
void PrintID() const
{
std::cout << "InternationalDrivingLicence::PrintID() : "sv << ((IdentityDocument*)this)->GetID() << std::endl;
}
void Delete()
{
delete this;
}
private:
void (InternationalDrivingLicence::*del)();
void (InternationalDrivingLicence::*vMethod)()const;
DrivingLicence* vtable;
};
Editor is loading...