Javascript 面向对象和基于对象的语言之间的区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6954293/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 23:56:22  来源:igfitidea点击:

Difference between object oriented and object based language

javascriptoop

提问by VJAI

What is the difference between an object oriented and an object based programming language? Is JavaScript is an object oriented or based?

面向对象和基于对象的编程语言有什么区别?JavaScript 是面向对象的还是基于对象的?

回答by TJHeuvel

Wikipediasays:

维基百科说:

In computer science, the term object-based has two different senses:

  • A somehow limited version of object-oriented programming, where one or more of the following restrictions applies: (a) There is no implicit inheritance, (b) there is no polymorphism, (c) only a very reduced subset of the available values are objects (typically the GUI components).

  • Prototype-based systems (that is, those based on "prototype" objects that are not instances of any class).

在计算机科学中,基于对象的术语有两种不同的含义:

  • 面向对象编程的某种受限版本,其中一个或多个以下限制适用:(a) 没有隐式继承,(b) 没有多态性,(c) 只有可用值的非常减少的子集对象(通常是 GUI 组件)。

  • 基于原型的系统(即那些基于不是任何类的实例的“原型”对象的系统)。

Javascript is object based.

Javascript 是基于对象的。

回答by P Kulek

Object Orientedis based on message passing, no classes or inheritance involved.

面向对象基于消息传递,不涉及类或继承。

"Object oriented" coined by Dr Alan Kay has been hiHymaned by C++, Java and Co, Dr Alan Kay made it clear that OO was messages, not classes. Dr Alan Kay On OO "OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things."

Alan Kay 博士创造的“面向对象”已被 C++、Java 和 Co 劫持,Alan Kay 博士明确指出 OO 是消息,而不是类。Alan Kay On OO 博士“对我来说,OOP 仅意味着消息传递、本地保留和保护以及状态过程的隐藏,以及所有事物的极端后期绑定。”

Erlang, LISP, Smalltalk are OO programming languages, not C++, Java, c# etc which are in effect object based.

Erlang、LISP、Smalltalk 是面向对象的编程语言,而不是 C++、Java、c# 等实际上基于对象的编程语言。

回答by kyakya

I found there are two version of answer for this question.

我发现这个问题有两个版本的答案。

Firstly, you must define what is object-oriented language.

首先,您必须定义什么是面向对象语言。

  1. From English wiki, you can find that class-based language is object-oriented language, and prototype-based language is not object-oriented language. They think if a language only uses "object" is not enough,so it is not an object-oriented language.
  2. From mozilla, you can find that prototype-based language is object-oriented language. Because they think if a language uses "object", it is an object-oriented language. And then they divide object-oriented into two type:
    • class-based and object-based object-oriented.
    • object-based(or prototype-based) object-oriented
  1. English wiki可以发现,基于类的语言是面向对象的语言,基于原型的语言不是面向对象的语言。他们认为如果语言只使用“对象”是不够的,所以它不是面向对象的语言。
  2. mozilla可以发现,基于原型的语言是面向对象的语言。因为他们认为如果一种语言使用“对象”,它就是一种面向对象的语言。然后他们将面向对象分为两种类型:
    • 基于类和基于对象的面向对象。
    • 基于对象(或基于原型)的面向对象


My English is not very good. If you are Chinese, you can see Chinese wiki.

我的英文不是很好。如果你是china人,你可以看中文维基

回答by Jawad Zeb

Object-oriented language

面向对象语言

Object-oriented language doesn't has in-built object. It has all feature of OOP. Object-oriented languages are C++, C#, Java etc

面向对象语言没有内置对象。它具有 OOP 的所有功能。面向对象的语言有 C++、C#、Java 等

Object-based language

基于对象的语言

Object-based language doesn't support all the features of OOPs like Polymorphism and Inheritance. It has in-built object like javascript has window object.languages are Javascript, VB etc.

基于对象的语言并不支持 OOP 的所有特性,如多态性和继承性。它具有内置对象,例如 javascript 具有窗口对象。语言是 Javascript、VB 等。