Is is a good practice to put the definition of C++ classes into the header file?

前端 未结 5 1737
暖寄归人
暖寄归人 2020-12-02 09:01

When we design classes in Java, Vala, or C# we put the definition and declaration in the same source file. But in C++ it is traditionally preferred to separate the definitio

5条回答
  •  暖寄归人
    2020-12-02 09:31

    In general, it is a good practice to seperate implementation from headers. However, there are exceptions in cases like templates where the implementation goes in the header itself.

提交回复
热议问题