Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Pointers between two objects (C++)

Name: Anonymous 2006-11-11 13:17

Hi!

I'm trying to make two objects of two different classes who both point to each other; something like this:

#pragma once
#include "b.h"
Class a
{
 a(b* _ptr){ b = _ptr; }
 b* ptr;
};
____________
#pragma once
#include "a.h"
Class b
{
 b(a* _ptr){ a = _ptr; }
 a* ptr;
};

(Please forgive any syntax errors..)
Anyway; i can't include both .h files into each, it of course fucks the compiler up. So how would one go about doing this? I know i could just point directly into memory using some kind of empty template, but im not sure how to go about doing this

Name: Anonymous 2006-11-11 14:15

Ofc im not using some old piece of garbage.

Thank you for the input, this should work great, even though it feels a bit like a hack.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List