#include <iostream>
#include <cstring>
using namespace std;

class Parent{
public:
	Parent operator=(const Parent&) = delete;
	Parent(const Parent&) = delete;
	Parent() = default;
	Parent(int complex) : test(complex) {}

	virtual void func(){ cout << test; }
private:
	int test = 0;
};

class Parent2{
public:
	Parent2 operator=(const Parent2&) = delete;
	Parent2(const Parent2&) = delete;
	Parent2() = default;
	Parent2(int complex) : test2(complex) {}

	virtual void func2(){ cout << test2; }
private:
	int test2 = 0;
};

class Child : public Parent, public Parent2{
public:
	Child operator=(const Child&) = delete;
	Child(const Child&) = delete;
    Child(const char* parent, const char* parent2){
    	const auto vTablePtrSize = sizeof(void*);
    	const auto parentSize = sizeof(Parent);
    	auto charPtrThis = reinterpret_cast<char*>(this);
    	
    	memcpy(charPtrThis + vTablePtrSize,
    	       parent + vTablePtrSize,
    	       parentSize - vTablePtrSize);
    	       
        memcpy(charPtrThis + parentSize + vTablePtrSize,
               parent2 + vTablePtrSize,
               sizeof(Parent2) - vTablePtrSize);
	}

	virtual void func(){ cout << "Child, parent says: "; Parent::func(); }
	virtual void func2(){ cout << "Child, parent2 says: "; Parent2::func2(); }
};



int main() {
	Parent foo(13);
	Parent2 foo2(42);
	Child bar(reinterpret_cast<char*>(&foo), reinterpret_cast<char*>(&foo2));

	bar.func();
	bar.func2();

	return 0;
}