How can I make visible variables/functions in particular files? For example, lets say I have this hierachy of files:
a.h
extern int var;
a.cpp
#include "a.h"
int var;
b.h
#include "a.h"
void function();
b.cpp
#include "b.h"
void function() {
var = 0;
}
in main.cpp I want to be able call function(), but not to access var variable
#include "b.h"
int main(int argc, char** argv) {
function(); /* possible to call */
var = 0 /* var shouldn't be visible */
}
I don't want file a.h to be included in main.cpp - only b.h. How can I achieve this?
a.hinb.hbut include it inb.cpp- Dave Rager