GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Python-Design-Patterns/01_inheritance at master · ahmed534/Python-Design-Patterns

Expand file tree

/

01_inheritance

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

01_inheritance

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
README.md
README.md
 
 
main.py
main.py
 
 

README.md

Inheritance

  • when you have a child class that gets basic behavior from parent class
  • used to avoid rewriting common functions in every class that share similar behavior

In this example, we have two types on enemies (Ninja and Zombie). Since all enemies share certain behaviors (moving left and right) we can write all of the common functionality inside one parent class instead of every enemy class.

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.