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

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

提問(wèn)人:楊紫紅發(fā)布時(shí)間: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ù)查找其他問(wèn)題的答案?

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