Hi im having a little problem understanding how class pointers work. Ill explain as best i can what i dont understand...
Im trying to do a simple graph like data structure, and am having a few problems understanding how to reference the pointers and use them, also if im using them correctly.
The class A should be able to point to 6 neighbours of class A, each of these neighbours in turn have 6 neighbours and so on.
I have a class A like so
In A how do i reference the one two etc? Im trying something like below but am having problems.
A *one, *two, *three, *four, *five, *six;
How do i get the pointer from a.one to point to object b? Am i using the correct notation? Sorry im new to pointers...!
using namespace std;
int main(int argc, char *argv)
// a's first neighbour points to b's four neighbour
a.one = b;
b.four = a;
Also have i defined the class A correctly for the problem im doing?
Sorry if this is a little vague!!!