I'd be happy to take a reference if this has been addressed elsewhere.
What is the best practice for including #defines in the current class header files (.h) versus the #defines in .h files of a contained class?
For example: In my A.cpp file:
A::A(){
B bObj(A_DEFAULT_WIDTH,A_DEFAULT_HEIGHT);
}
In my A.h file:
#define A_DEFAULT_WIDTH 10
#define A_DEFAULT_HEIGHT 10
#include "B.h"
class A{
private:
public:
A();
};
In my B.h file:
#define B_DEFAULT_WIDTH 10
#define B_DEFAULT_HEIGHT 10
class B{
private:
int width;
int height;
public:
B(int,int);
};
In my B.cpp file:
B::B(int inWidth, int inHeight){
width = inWidth;
height = inHeight;
}
Clearly I could just use the #defines from B in the A class, but is it better to replicate these #defines in A to keep A better abstracted, or is it better to use the B defines and get rid of the A #defines so that the replicated #defines in A don't cause confusion and get out of sync?