Complat software training 101
  • Introduction
  • Day 1
  • Day 2
  • TODO
  • Linear regression
  • Tmux
  • quick link
  • CLI more - 1
  • Vim more - 1
  • MQ
  • iv - 1
  • iv - 2
  • iv - 3
  • clear Arch
  • lv - array
  • INTERVIEW - JS
  • RDKit - read/write
  • RDKit - process
  • RDKit - transform
  • RDKit - rxn
  • SYSTEM DESIGN - Question
  • SYSTEM DESIGN - EX1
  • SYSTEM DESIGN - EX2
  • SYSTEM DESIGN - EX3
  • SYSTEM DESIGN - EX99
Powered by GitBook
On this page
  • Inheritance
  • Encapsulation
  • Polymorphism

Was this helpful?

iv - 1

Inheritance

class ParentClass:
    # body of ParentClass
    # method1

class ChildClass(ParentClass):
    # body of ChildClass
    # method 1

在A公司當過N年軟體工程師的經驗,我以前的經驗可以繼承,您不用花時間心力成本教我訓練我,而且我會根據貴公司的狀況調整我的工作方式。

Encapsulation

public_method()
__private_method()
  • restrict access to methods and variables

  • avoid accidentally assignments [不希望counter 被assignment 而改動] / conveniently change name

封裝良好的軟體工程師,只要將任務交待給我,就會把程式寫好,您不用耗費心力在細節中,可以去專心在您的核心業務。

Polymorphism

  • same function name (but different signatures) being uses for different types.

  • (o) method overriding

  • (X) method overloading

我不僅是軟體工程師,事實上,我是個多型者。我可以是資料科學家,UI/UX設計師,DBA。總之,我就是一個職員。只要您說,"職員去做事",我就會根據狀況做好該做的事,不管是分析資料,設計UI,備份資料。

# Polymorphism with Inheritance:
class Bird: 
  def intro(self): 
    print("There are many types of birds.") 

  def flight(self): 
    print("Most of the birds can fly but some cannot.") 

class sparrow(Bird): 
  def flight(self): 
    print("Sparrows can fly.") 

class ostrich(Bird): 
  def flight(self): 
    print("Ostriches cannot fly.") 

obj_bird = Bird() 
obj_spr = sparrow() 
obj_ost = ostrich() 

obj_spr.intro() 
obj_spr.flight() 

obj_ost.intro() 
obj_ost.flight()
PreviousMQNextiv - 2

Last updated 5 years ago

Was this helpful?