- 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.
- Advanced Splunk
- 趣學Python算法100例
- MATLAB 2020 從入門到精通
- PHP+MySQL網站開發技術項目式教程(第2版)
- INSTANT Sencha Touch
- Building Mobile Applications Using Kendo UI Mobile and ASP.NET Web API
- 64位匯編語言的編程藝術
- 用Flutter極速構建原生應用
- 精通Python自然語言處理
- Python數據挖掘與機器學習實戰
- Mastering AWS Security
- Orleans:構建高性能分布式Actor服務
- Cocos2d-x Game Development Blueprints
- JavaScript程序設計:基礎·PHP·XML
- SwiftUI極簡開發