I have a class called A with the following definition:
class A {
public:
int time;
A *next;
someFunc();
A();
virtual ~A();
};
I have a subclass of A, called B, with the following definition:
#include "A.h"
class B : public A {
public:
int state;
Foo *ID;
someFunc();
B(int time, A *next, int state, Foo *id);
virtual ~B();
};
B's constructor is defined as:
B::B(int time, A *next, int state, Foo *id) : time(time), next(next), state(state), ID(id) { }
When I build the program, I get an error that class B has no fields named "time" or "next." I made sure that I have A.h included in the B.h file as well as the B.cpp file but it seems not to make a difference. Notably, someFunc() in class B is recognized. I define a body different from class A's version in B.cpp. At the declaration in B.h, Eclipse has a marker reminding me it "shadows" A::someFunc(), so I know B has inherited at least that.
I am working on this program in Eclipse and using a makefile to build it. My line for building B.o is:
B.o: B.cpp B.h
g++ -c -Wall -g B.cpp
I have also tried adding A.h at the end of the first line, which does nothing. Am I missing something from here that could cause this error?