没有类概念的面向对象语言 [英] Object-oriented languages without class concept

查看:138
本文介绍了没有类概念的面向对象语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读Scala论文的介绍,并发现以下陈述:

I am reading introduction to Scala paper and found following statement:

应注意,某些面向对象的语言没有 类的概念.

It should be noted that some object-oriented languages do not have the concept of class.

问题:哪些面向对象的语言没有类概念,它们如何处理类型(类)-对象(类型实例)的关系?

Question: Which object-oriented languages do not have class concept and how do they handle type(class) - object(type instance) relationship ?

推荐答案

尽管在流行语言中将它们进行合并是很常见的,但是类和类型却是不同的概念.正确地将类理解为对象的蓝图,定义了类实例所具有的属性和方法,而(对象)类型是接口,描述了可以使用哪些参数调用哪些方法.

Although it is common in popular languages to conflate them, classes and types are different concepts. A class is properly understood as a blueprint for an object, defining the attributes and methods that instances of the class possess, but an (object) type is an interface, describing what methods can be called with what parameters.

因此,不假想没有类的语言就不难了.您所需要的只是某种用于创建对象以及为(新)对象赋予属性和方法的构造. Javascript是一个众所周知的示例.在这样的语言中,继承看起来有点不寻常,但是可以做到(例如参见 Antero Taivalsaari的文章论概念"继承" ).

Thus, it is not difficult to imagine languages without classes. All you need is some kind of a construct for creating objects and for giving (new) objects attributes and methods; Javascript is a well known example. Inheritance will look a bit unusual in such languages, but certainly can be done (see for example Antero Taivalsaari's article "On the notion of inheritance").

这篇关于没有类概念的面向对象语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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