Hey guys, i have two classes, viz:
Connection class in file "Connection.h" and
Statement class in file "Statement.h"
Connection class references Statement, since it creates and then returns the statement, viz:
Statement Connection::createStatement();
again, the Statement class reference the Connection that created it
Connection.h _must_ #include Statement.h in order to allow the declaration of Connection::createStatement() to compile.
But then Statement.h _must not_ include Connection.h, otherwise you end up with circular dependencies. Statement.h
can use pointers to Connections in declarations, but that is all.
So you can forward declare Connection in Statement.h:
class Connection;
prior to first use.
As for your second problem, instantiating variables in header files is a no-no. You'll need to move line 13 of connection.h
to a .cpp file.