Closed raffomania closed 9 years ago
Hello there,
The documentation that exists is in the Wiki:
https://github.com/kikito/middleclass/wiki
Is this enough for you, or do you need more guidance?
Thanks! I found the documentation in the wiki and read it, but didn't find any information on how inheritance works.
I'm afraid I will have to ask you to be more concise. Are you looking for a description of inheritance as a concept in object orientation? Are you asking about the implementation details of that concept in the context of this library? Or is it something else?
I'm looking for precise usage instructions on inheritance in middleclass:
The standard way to do inheritance is class('A', B)
. In addition to that, you can also do B:subclass('A')
. Both expressions will return A (a subclass of B). A.super
will return B
.
When you call A:new(), only A:initialize()
gets called - the constructor of B is not called by default. There is no super
, instead you have to use an explicit self
:
function A:initialize()
...
B.initialize(self, ...)
...
end
The same applies for non-constructor methods - there is no super
keyword-like construction, so you must use explicit self calls.
You may find an example of all this in the Quick Example and on the Readme. Do you feel they are not clear enough?
Hey, that's nice! It clarified a lot of things for me. Indeed, I feel that the Wiki should contain a part exactly like your comment above, to explicitly explain how inheritance works.
Added the notes to the Quick intro pages. Closing down this issue.
Please close if I missed a part of the docs ;) I'd like to have some information about inheritance in middle class - the lua users wiki (http://lua-users.org/wiki/ObjectOrientedProgramming) says it supports "basic inheritance". If so, how exactly does it work and what are it's limitations?