Part-III - Python: Object Oriented Programming
In part-II of this series, we saw how inheritance works when we derive from a single base class. In part-II, the base and derived classes were all declared in the same file. In this article, we look at how classes can be declared in their own files and how they reference each other. The ability to reference source code in multiple files is a very important requirement towards building complex scalable applications. Our project solution will the have following 3 files: Python C# Comments CBaseMath.py CBaseMath.cs Base class code CAdvancedMath.py CAdvancedMath.cs Derived class code Program.py Program.cs Code to instantiate and call functions The code for each of these files is given below: CBaseMath.py / CBaseMath.cs Python class CBaseMath: def __init__(self, sigDigits): self.__sigDigits=sigDigits #This is a private function #There is no keyword in Python to make this protec...