Refactor instantiation: replace oop.new with direct constructor calls for BankAccount and PremiumAccount
This commit is contained in:
parent
7c7671a15a
commit
d8cfdd2900
4
main.lua
4
main.lua
@ -46,11 +46,11 @@ function PremiumAccount(cls)
|
||||
end
|
||||
end
|
||||
|
||||
local acct = oop.new(BankAccount, "Kim", 1234)
|
||||
local acct = BankAccount("Kim", 1234)
|
||||
acct.deposit(100)
|
||||
acct.withdraw(30, 1234)
|
||||
|
||||
local vip = oop.new(PremiumAccount, "Sam", 9999)
|
||||
local vip = PremiumAccount("Sam", 9999)
|
||||
vip.monthly_bonus()
|
||||
|
||||
local ok, err = pcall(function()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user