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

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.

主站蜘蛛池模板: 太和县| 卓尼县| 德阳市| 宜章县| 衡水市| 玉溪市| 敦煌市| 镇赉县| 武夷山市| 乐安县| 大冶市| 博白县| 尚志市| 淮滨县| 莱阳市| 临海市| 隆化县| 乌鲁木齐市| 牙克石市| 荣成市| 扬中市| 翁源县| 漳浦县| 寿光市| 裕民县| 通道| 钟祥市| 台州市| 西和县| 政和县| 阿克陶县| 聂拉木县| 永定县| 广汉市| 工布江达县| 鄂尔多斯市| 安陆市| 托里县| 廉江市| 新营市| 漳平市|