Alright so I have a header file that includes another class with a pointer to a structure as a private variable. Does my second header have to be a pointer too or can it be static?

#ifndef EXAMPLE1_H
#define EXAMPLE1_H

struct ex {
          int blah;
          char meh;
};

class example1 {
      public:
             example1();
             ~example1();
      private:
            ex *ptr;
}

#endif

as my first header

#ifndef EXAMPLE2_H
#define EXAMPLE2_H

#include "example1.h"

class example2 : public example1 {

         public:
         example2();
        ~example2();
         void blah();

         private:
         example1 test[8][8];
}

my actual code is for chess, but these two snippets are the jist of my question.

>>Does my second header have to be a pointer too or can it be static?

No, it does not need to be a pointer. what you have on line 14 of class example2 looks ok to me.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.