mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-10 02:31:48 +00:00
updated class docs about super construction
This commit is contained in:
parent
7813bf35a1
commit
453f00d82f
16
class.lua
16
class.lua
@ -1,14 +1,24 @@
|
||||
--[[
|
||||
barebones oop basics
|
||||
|
||||
call the class object to construct a new instance
|
||||
construction
|
||||
|
||||
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
|
||||
metamethods "just work" - except for index, which is
|
||||
used to hook up instance methods
|
||||
|
||||
classes do use a prototype chain for inheritance, but
|
||||
also copy their interfaces (including superclass)
|
||||
classes do use a prototype chain for inheritance, but
|
||||
also copy their interfaces (including superclass)
|
||||
|
||||
we copy interfaces in classes rather than relying on
|
||||
a prototype chain, so that pairs on the class gets
|
||||
|
Loading…
Reference in New Issue
Block a user