Can I write C++ code without headers (repetitive function declarations)?

前端 未结 24 819
半阙折子戏
半阙折子戏 2020-11-28 07:55

Is there any way to not have to write function declarations twice (headers) and still retain the same scalability in compiling, clarity in debugging, and flexibility in desi

24条回答
  •  时光取名叫无心
    2020-11-28 08:14

    There is no practical way to get around headers. The only thing you could do is to put all code into one big c++ file. That will end up in an umaintainable mess, so please don't do it.

    At the moment C++ header-files are a nessesary evil. I don't like them, but there is no way around them. I'd love to see some improvements and fresh ideas on the problem though.

    Btw - once you've got used to it it's not that bad anymore.. C++ (and any other language as well) has more anoying things.

提交回复
热议问题