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

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.

主站蜘蛛池模板: 曲阜市| 莫力| 九寨沟县| 渭南市| 疏附县| 长汀县| 百色市| 那坡县| 桃江县| 南川市| 磴口县| 吉安市| 遂宁市| 鹰潭市| 南丰县| 鄄城县| 西林县| 淮滨县| 杨浦区| 广宁县| 社旗县| 陆丰市| 宁河县| 镇雄县| 应城市| 花垣县| 琼海市| 讷河市| 温泉县| 灵川县| 东光县| 陆川县| 富源县| 抚宁县| 阿图什市| 定南县| 吐鲁番市| 台中县| 英德市| 秭归县| 泰顺县|