Refactor instantiation: replace oop.new with direct constructor calls for BankAccount and PremiumAccount

This commit is contained in:
Chipperfluff 2026-01-01 17:55:52 +01:00
parent 7c7671a15a
commit d8cfdd2900

View File

@ -46,11 +46,11 @@ function PremiumAccount(cls)
end end
end end
local acct = oop.new(BankAccount, "Kim", 1234) local acct = BankAccount("Kim", 1234)
acct.deposit(100) acct.deposit(100)
acct.withdraw(30, 1234) acct.withdraw(30, 1234)
local vip = oop.new(PremiumAccount, "Sam", 9999) local vip = PremiumAccount("Sam", 9999)
vip.monthly_bonus() vip.monthly_bonus()
local ok, err = pcall(function() local ok, err = pcall(function()