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

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.

主站蜘蛛池模板: 镇巴县| 莱西市| 中牟县| 徐州市| 枝江市| 重庆市| 定结县| 疏勒县| 西城区| 涿州市| 井研县| 屏山县| 博罗县| 松溪县| 东丽区| 广河县| 贞丰县| 临邑县| 呈贡县| 鲁山县| 偏关县| 永善县| 德兴市| 建昌县| 元阳县| 墨脱县| 金湖县| 台北市| 泾源县| 海城市| 明溪县| 城口县| 大关县| 定西市| 深泽县| 陵川县| 金湖县| 集贤县| 大洼县| 萝北县| 老河口市|