User Tools

Site Tools


python:about_python:about_python_iv

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Last revision Both sides next revision
python:about_python:about_python_iv [2013/07/05 06:19]
mithat created
python:about_python:about_python_iv [2014/02/28 22:18]
mithat [Inheritance]
Line 33: Line 33:
 One of the advantages of implementing classes with inheritance is **code reuse**.  Almost all class-based object oriented languages let you define derived classes //without having to re-write the base class code//. The idea is that you write the base class code //once//. Then when you write the derived classes, you add only whatever new code is required for the derived class or new definitions for old code that must be **overridden**. One of the advantages of implementing classes with inheritance is **code reuse**.  Almost all class-based object oriented languages let you define derived classes //without having to re-write the base class code//. The idea is that you write the base class code //once//. Then when you write the derived classes, you add only whatever new code is required for the derived class or new definitions for old code that must be **overridden**.
  
-Since you do not need to rewrite the code that is common to both base and derived classes, you end up writing less code. But even more important, when you fix a bug in the base class, it automatically propagates down to the derived classes.+Since you do not need to rewrite the code that is common to both base and derived classes, you end up writing less code. But even more important, when you fix a bug in the base class, it automatically propagates to the derived classes.
  
 === Inheritance and polymorphism === === Inheritance and polymorphism ===
python/about_python/about_python_iv.txt · Last modified: 2019/06/21 23:09 by mithat