I used Macros at top of class to tell what is 1 and 45.00 instead of just writing magic numbers.
Question is why using Macros in following class (see the default constructor) is not a good idea? Why using const int LIMIT_UNDER = 1 better? I think there is no difference.
But if I do use that constant at class data member level(global const is not a good thing we know), i.e.const int LIMIT_UNDER, will I initialise it using constructor initializer list?
Class details:-
The Cube class which I have to calculate volume also. The class can have a user input of FLOAT length, width and height in between minimum 1 to maximum 45.00. Otherwise if user inputs any other numbers its all sides would be 1.
so it will be like
// Use MACRO or CONST???
#define LIMIT_UNDER 1
#define LIMIT_UPPER 45.00
class Cube {
float height;
float width;
float length;
public:
// Write setter getters here
// default constructor
Cube() {
// default constructor puts default values
height = width = length = LIMIT_UNDER;
// Other code of class...
)