“封装”是这样吗?和“抽象”?
封装只是隐藏了程序的内部机制
抽象是为封装的程序提供公共接口,
这是真的吗?
Encapsulation is just hiding the internal mechanism of the program
Abstraction is providing a public interface from encapsulated program
is that true ??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
http://en.wikipedia.org/wiki/Object-oriented_programming#Encapsulation
http://en.wikipedia.org/wiki/Object-oriented_programming#Encapsulation
http://en.wikipedia.org/wiki/Object-oriented_programming#Abstraction
封装是通过隐藏组件的实现细节同时公开一致的接口来减少组件之间的紧密耦合。封装意味着您可以更改单元执行其工作的方式,而不会影响使用该单元的所有其他单元的行为。
抽象是简化或概括某些事物的更一般的概念。为了更好的解释:http://en.wikipedia.org/wiki/Abstraction_(computer_science)
Encapsulation is how you reduce tight coupling between components, by hiding their implementation details while exposing a consistent interface. Encapsulation means you can change how a unit performs its work without affecting the behaviour of all other units that use it.
Abstraction is the more general concept of simplifying or generalizing something. For a better explanation: http://en.wikipedia.org/wiki/Abstraction_(computer_science)