头文件对谁重要? [英] for whom the header files are important?

查看:83
本文介绍了头文件对谁重要?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




头文件对谁重要?


为程序员或编译器.. ??

因为程序员很好地通过头文件看到类的所有私有数据

..但如果他试图访问它那么

编译器抛出错误..

谢谢和问候,

Yogesh Joshi

Hi,

for whom the header files are important?

for the programmer or for the compiler..??
As the programmer very well sees all the private data of a class
through the header file ..but if he tries to access it then the
compiler throws the error..
Thanks and Regards,
Yogesh Joshi

推荐答案

yo******@gmail.com 写道:




头文件对谁来说很重要?


为程序员或编译器......? ?

因为程序员很好地通过头文件看到一个类的所有私有数据

..但如果他试图访问它那么

编译器抛出错误..
Hi,

for whom the header files are important?

for the programmer or for the compiler..??
As the programmer very well sees all the private data of a class
through the header file ..but if he tries to access it then the
compiler throws the error..



头文件允许您创建接口代码的可重用性。


对于私人数据,如果您愿意,可以在cpp文件中隐藏所有私有的

元素。


Header files allow you to create "interfaces" and reusability of code.

As for private data, you can, if you wish, hide all your private
elements in the cpp file.


yo******@gmail.com 写道:

yo******@gmail.com wrote:


头文件对谁重要?


为程序员或编译器.. ??
for whom the header files are important?

for the programmer or for the compiler..??



编译器。

The compiler.


因为程序员很好地看到了类的所有私有数据/>
通过头文件..但如果他试图访问它,那么

编译器会抛出错误..
As the programmer very well sees all the private data of a class
through the header file ..but if he tries to access it then the
compiler throws the error..



程序员应该阅读文档/规范。

标题中的内容是实现细节。

最好


Kai-Uwe Bux

The programmer is supposed to read the documentation/specs. Stuff in the
headers are implementation details.
Best

Kai-Uwe Bux



yo******@gmail.com




头文件对谁重要?


为程序员或编译器.. ??

因为程序员很好地通过头文件看到类的所有私有数据

..但是如果他尝试访问它然后

编译器抛出错误..


谢谢和问候,

Yogesh Joshi
Hi,

for whom the header files are important?

for the programmer or for the compiler..??
As the programmer very well sees all the private data of a class
through the header file ..but if he tries to access it then the
compiler throws the error..
Thanks and Regards,
Yogesh Joshi



就编译器而言,头文件不存在。

也就是说,直到你将它们包含在源代码中。

没有什么可以阻止你访问一个类的私有部分,



这是访问者和公共成员函数的用途。 br />
编译器生成错误,因为类的声明是编译器必须遵守和执行的规则集。

As far as the compiler is concerned, header files don''t exist.
That is, until you include them into your source(s).
And nothing stops you from accessing the private parts of a class,
either.
Thats what accessors and public member functions are for.
Compilers generate errors because the declaration of the class is a set
of rules the compiler must obey and enforce.


这篇关于头文件对谁重要?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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