updated class docs about super construction

This commit is contained in:
Max Cahill 2021-07-16 19:39:24 +10:00
parent 7813bf35a1
commit 453f00d82f

View File

@ -1,8 +1,18 @@
--[[ --[[
barebones oop basics barebones oop basics
construction
call the class object to construct a new instance call the class object to construct a new instance
this will construct a new table, assign it as a class
instance, and call `new`
if you are defining a subclass, you will need to call
`self:super(...)` as part of `new` to complete superclass
construction - if done correctly this will propagate
up the chain and you wont have to think about it
classes are used as metatables directly so that classes are used as metatables directly so that
metamethods "just work" - except for index, which is metamethods "just work" - except for index, which is
used to hook up instance methods used to hook up instance methods