CPP | .h文件(C ++) [英] CPP | .h files (C++)

查看:92
本文介绍了CPP | .h文件(C ++)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道.cpp和.h文件之间的区别是什么?我将使用头文件(.h)和cpp文件来做什么?

I was just wondering what the difference between .cpp and .h files is? What would I use a header file (.h) for and what would I use a cpp file for?

推荐答案

总的来说,它的通用性可能要差很多:

In general, and it really could be a lot less general:

.h (头文件)用于声明多次使用的事物,并在其他文件中#include d

.h (header) files are for declarations of things that are used many times, and are #included in other files

.cpp (实施)文件用于其他所有文件,几乎从不#include d

.cpp (implementation) files are for everything else, and are almost never #included

这篇关于CPP | .h文件(C ++)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆