Programming Basic--what's the diff between const and #define?

        to define a const, we can use const as well as #define in C++ .however the former has more benifits than later.
        1) const has data type ,however Macro has no. so the complier can check the data type for the former , but not for the later.
        2) some integrated tools can debug with const while not with macro. therefore we can use const completely taking place of Macro.

你可能感兴趣的:(programming)