Q
qazmlp
As I understand, there will be 100 copies of "myTestClass", when
CLASSNAME is declared as below & it is used 100 times in the code:
#define CLASSNAME "myTestClass"
But, there will be only 1 copy of "myTestClass", when
CLASSNAME is declared as below irrespective of the number of times
CLASSNAME is used:
const char* CLASSNAME = "myTestClass" ;
Is my understanding correct ? Isn't that an advantage of 'const'
over '#define' declaration for constants?
CLASSNAME is declared as below & it is used 100 times in the code:
#define CLASSNAME "myTestClass"
But, there will be only 1 copy of "myTestClass", when
CLASSNAME is declared as below irrespective of the number of times
CLASSNAME is used:
const char* CLASSNAME = "myTestClass" ;
Is my understanding correct ? Isn't that an advantage of 'const'
over '#define' declaration for constants?