位置:首頁 > 軟件操作教程 > 編程開發(fā) > Python > 問題詳情

Class定義——python函數(shù)

提問人:楊紫紅發(fā)布時間:2020-11-26

Class定義

class Account(object):

#只在__init__中定義成員變量

def __init__(self, initial):

self.balance = initial

  #析構(gòu)

def __del__(self):

pass


  def deposit(self, amount):

  self.balance += amount

  def withdraw(self, amount):

  self.balance -= amount

  def getBalance(self):

  return self.balance

繼續(xù)查找其他問題的答案?

相關(guān)視頻回答
回復(0)
返回頂部