wenn ich bspw. folgenden Aufbau habe:
Code: Alles auswählen
class k3;
class k2
{
	private:
		k3 k3_obj;
};
class k1
{
	private:
		k2 k2_obj;
	public:
		void callback()
};
main.cpp
Code: Alles auswählen
#include <iostream>
#include "main.h"
using namespace std;
k3::k3(k1 *grand_parent)
{
    this->k1_ptr = grand_parent;
    this->irgendetwas_wichtiges();
}
void k3::irgendetwas_wichtiges()
{
    this->k1_ptr->callback();
}
k2::k2(k1 *parent) : k3_obj(parent)
{
}
void k1::callback()
{
    cout << "Callback wurde aufgerufen" << endl;
}
k1::k1() : k2_obj(this)
{
}
int main()
{
    k1 temp;
    return 0;
}
Code: Alles auswählen
class k1;
class k3
{
	private:
		k1 *k1_ptr;
	public:
		k3(k1 *grand_parent);
		void irgendetwas_wichtiges();
};
class k2
{
	private:
		k3 k3_obj;
	public:
		k2(k1 *parent);
};
class k1
{
	private:
		k2 k2_obj;
	public:
        k1();
		void callback();
};
Mfg.
hackmack


