C++ programming style

前端 未结 16 1711
眼角桃花
眼角桃花 2021-02-07 22:33

I\'m an old (but not too old) Java programmer, that decided to learn C++. But I have seen that much of C++ programming style, is... well, just damn ugly!

All that stuff

16条回答
  •  天涯浪人
    2021-02-07 22:51

    .h and .cpp files often separate declarations from definitions, and there is some kind of order here, and conceptual encapsulation. headers have the 'what', implementation files have the 'how'.

    I find having everything in one file in java to be disorganized. So, each to their own.

    C++ conventions and idioms all have well thought out reasoning, just like any other language does for the idioms its community adopts.

    I think it's best to java (as a verb) when you write Java, and to C++ when you C++! You'll appreciate why with experience of the language. Same as switching to any new language.

提交回复
热议问题