赞
踩
面向对象什么呢?
面向「对象」应该是。。。。 此处应该有表情包,但是。。。。
面向对象是一种编码思想,简单来说就是将实体对应成一个实体的对象,解释概念有些没什么实际作用。这里就直接一点,面向对象最重要的两个概念就是对象和类。面向对象最基本特征就是封装,继承,抽象,多态。这四个特征是面向对象的基石。
Go 语言是面向对象语言吗?
我们来看看 go 语言官方解释:
Is Go an object-oriented language? Yes and no. Although Go has types and methods and allows an object-oriented style of programming, there is no type hierarchy. The concept of “interface” in Go provides a different approach that we believe is easy to use and in some ways more general. There are also ways to embed types in other types to provide something analogous—but not identical—to subclassing. Moreover, methods in Go are more general than in C++ or Java: they can be defined for any sort of data, even built-in types such as plain, “unboxed” integers. They are not restricted to structs (classes).
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。