What should go into an .h file?

后端 未结 12 998
伪装坚强ぢ
伪装坚强ぢ 2020-11-22 15:26

When dividing your code up into multiple files just what exactly should go into an .h file and what should go into a .cpp file?

12条回答
  •  甜味超标
    2020-11-22 15:49

    the header file (.h) should be for declarations of classes, structs and its methods, prototypes, etc. The implementation of those objects are made in cpp.

    in .h

        class Foo {
        int j;
    
        Foo();
        Foo(int)
        void DoSomething();
    }
    

提交回复
热议问题