I've got a class A defined in a separate header file. I want class B to have a reference to a object of class A stored as a variable.
Like this:
File: A.h
class A {
//Header for class A...
};
File: B.h
#include "A.h"
class B {
private:
(24) A &variableName;
public:
(36) B(A &varName);
};
When i try to compile it with g++ I get the following error:
B.h:24: error: ‘A’ does not name a type
B.h:36: error: expected `)' before ‘&’ token
Any suggestions on what I'm doing wrong? If it matters, the class A is an abstract class.
EDIT: Some typos in the code