官术网_书友最值得收藏!

Object-oriented approaches in Python, JavaScript, and C#

Python, JavaScript, and C# support object-oriented programming, also known as OOP. However, each programming language takes a different approach. Both Python and C# support classes and inheritance. Therefore, you can use the different syntax provided by each of these programming languages to declare the Shape class and its four subclasses. Then, you can create instances of each of the subclasses and call the different methods.

On the other hand, JavaScript uses an object-oriented model that doesn't use classes. This object-oriented model is known as prototype-based programming. However, don't worry. Everything you have learned so far in your simple object-oriented design journey can be coded in JavaScript. Instead of using inheritance to achieve behavior reuse, we can expand upon existing objects. Thus, we can say that objects serve as prototypes in JavaScript. Instead of focusing on classes, we work with instances and decorate them to emulate inheritance in class-based languages.

Tip

The object-oriented model known as prototype-based programing is also known by other names such as classless programming, instance-based programming, or prototype-oriented programming.

There are other important differences between Python, JavaScript, and C#. They have a great impact on the way you can code object-oriented designs. However, you will learn different ways throughout this book to make it possible to code the same object-oriented design in the three programming languages.

主站蜘蛛池模板: 林州市| 邵东县| 宜春市| 太仓市| 长汀县| 新民市| 永善县| 金溪县| 昭苏县| 神农架林区| 郓城县| 股票| 清镇市| 无锡市| 石屏县| 宁都县| 襄汾县| 民丰县| 鞍山市| 彭泽县| 榕江县| 同心县| 彰武县| 高安市| 赣州市| 天台县| 建平县| 鞍山市| 深州市| 平泉县| 五台县| 兴隆县| 会宁县| 名山县| 岳阳市| 大安市| 吉木乃县| 宕昌县| 汨罗市| 安图县| 香港 |