Hi all. We are going to see some examples of usage of keyword 'super' here .
Below code shows two classes Employee and Developer. A parent and a child.
Lets run the above program.
Observations and things to note
- Above programming is done in Python 2.7.
- In 2.7, the class needs to inherit from object , otherwise it wont work.
- The variable names can be different in both classes (In 2.7 only).
- super needs to have same class name as first argument.
- The class instance 'b' can access all class variables of both classes.