Java包与C ++库 [英] Java packages vs. C++ libraries

查看:173
本文介绍了Java包与C ++库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java 中,有一个名为的包 C ++ 中的表示相同的含义,尤其是在包含相关类和受保护成员的使用方面?

In Java, there is what is called package. Does library in C++ represent the same meaning, especially in terms for example of containg relative classes and the use of protected members?

谢谢。

推荐答案

有什么不同的维度 package 表示Java。作为一个容器,它区分内部类的名称和其他包中的类的名称,它的等价物将是c ++ 名称空间

There are different dimensions of what a package means in Java. As a container that differentiates the names of the classes inside from the names of classes in other packages, its equivalent would be c++ namespaces.

作为一个保证访问同一块中的类的非私有成员的单元,C ++中没有等价物。授予类的访问级别与定义类的命名空间无关。

As a unit that guarantees access to non-private members to classes in the same block, there is no equivalent in C++. The access level granted to a class is independent of the namespace where the class is defined.

作为一种在磁盘中对源进行排序的方法,没有等效的, C ++语言对代码如何存储在文件中没有要求。

As a way of ordering your sources in the disk, there is no equivalent, the C++ language has no requirements on how the code is stored in files.

关于c ++库,它更接近 jar Java中的文件。它们捆绑了不同的类,这些类具有某种关jar可以包含多个包,并且多个jar可以包含来自同一包的类。与库类似,它们可以包含来自不同命名空间的类和/或不同的库可以包含来自同一命名空间的类。

Regarding c++ libraries, that is closer to jar files in Java. They bundle different classes that share some relation. A jar can contain more than one package, and more than one jar can contain classes from the same package. Similarly with libraries, they can contain classes from different namespaces and/or different libraries can contain classes from the same namespace.

这篇关于Java包与C ++库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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