C++ One Header Multiple Sources

前端 未结 4 896
时光说笑
时光说笑 2021-02-19 22:35

I have a large class Foo1:

class Foo {
public:
    void apples1();
    void apples2();
    void apples3();

    void oranges1();
    void         


        
4条回答
  •  [愿得一人]
    2021-02-19 23:21

    Yes, you can define the class in one header file and split the function implementations accross multiple source files. It is not usually the common practice but yes it will work and there will be no overheads.

    If the aim to do so, is just plain readability, then perhaps it is not a good idea to do so, because it is not so common practice to have class function definitions accross multipls source files and might just confuse someone.

提交回复
热议问题