Our application has common classes used (for example, a class that contains project configuration parameters), as shown below.
class DB{
public:
int projectVersion
int somethingSoMuchImportantAllOverTheProject
};
extern DB* pDB;
Since all other classes will use this class, all of them must somehow access it. Our solution sets "extern DB * pDB"; under its header file so that anyone who needs it can access it after including the header. I think maybe there is a better solution and you want to get your ideas in this general case.
source
share