Python Archive
Accessing overridden functionality of Parent class: super(): It is pre-defined method. It is used to access Parent class functionality(super) from Child(sub). We can access the functionality of all classes in the hierarchy from one place …
Hierarchical and Hybrid Inheritance: Hierarchical inheritance: An object sharing the functionality to more than one object is called Hierarchical. We need to create object for every child to access the functionality. We cannot access the …
Multiple inheritance: If multiple objects extends the functionality of same object called multiple inheritance. When we access the functionality which is extended from Child, it starts searching from the left most Parent. This process is …
Polymorphism: Defining an object(class) that shows different behavior(methods) with the same identity. Polymorphism is of 2 types Compile time polymorphism Runtime polymorphism In the above diagram, we define an object(person) called “amar”. While object communicating …
Compile time polymorphism: It is also called “Static binding”. It is “Method Overloading” technique. Defining multiple methods with same name and different set of arguments is called “Overloading”. Depends on input values, corresponding method executes. …
Runtime Polymorphism: It is called “dynamic binding”. It is method “overriding technique”. Overriding is the concept of defining a method in Child class with the same name and same set of arguments in Parent class …
Exception Handling: Exception is a “class” Exception is a “Runtime Error” When exception rises, the flow of execution will be terminated with informal information to the user. Exception handling is the concept of working with …
try-except blocks: Python library is providing pre-defined keywords to handle exception. “try” block is used to place the doubtful code that raises exception. If any exception has risen in the try block, we need to …
Try with Multiple Exceptions: One try block can have many instructions (logic) set. Chance of getting different types of exceptions in different lines of code. We can handle different types of exception by defining more …
Exception class: “Exception” is pre-defined class. “Exception” is the Parent class of all other exception classes. Instead of handling multiple exceptions with number of except blocks, we can specify “Exception” type to handle all. We …