- Hands-On Penetration Testing with Python
- Furqan Khan
- 154字
- 2021-07-02 14:14:00
Polymorphism with classes (abstract classes)
There may be occasions in which we would want to define a template of a class in terms of what that class must do, but not in terms of how it should do it – we would want to leave that to the implementation of the class. This is where we can make use of abstract classes. Let's create a script called Poly_class.py and add the following code:

It can be seen that we have an abstract class called Shape, which has an area method. The area method is not implemented in this class, but it would be implemented in the child class. The Square and Circle child classes override the area method. The area method is polymorphic, which means that if a square overrides it, it implements the area of a square and when a Circle class overrides it, it implements the area of a circle.
- 數據庫系統教程(第2版)
- 算法零基礎一本通(Python版)
- Flask Web開發入門、進階與實戰
- 實戰低代碼
- Internet of Things with Intel Galileo
- Access 2016數據庫管
- OpenShift在企業中的實踐:PaaS DevOps微服務(第2版)
- 軟件供應鏈安全:源代碼缺陷實例剖析
- Photoshop CC移動UI設計案例教程(全彩慕課版·第2版)
- Groovy 2 Cookbook
- Koa與Node.js開發實戰
- Parallel Programming with Python
- Managing Windows Servers with Chef
- Appcelerator Titanium Smartphone App Development Cookbook
- SAP HANA Cookbook