I have class A such that:
class A {
static int i;
A();
f1();
f2();
static void intitiaize();
// snipped rest
}
void initialize() {
A::i = 0;
}
in a header file.
I have a intiialize function for the class which initializes the
static variables in main method in second file. After this i create
an object of A
to call a.f1()
.
When I try to create another object of A
in file three the compiler complains
saying "no reference to class A". So included the header in this third file.
I get an error about multiple definitions of A
.
How should I proceed? I have include guards around the class file.