You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 27, 2021. It is now read-only.
We start by thinking that all living beings have an age, which if it is not provided, it must be 0.
Now we will create a Human class that will inherit from Being, we will do it like this:
localHuman=Class ("Human", Being) (function (argl)
-- I haven't been able to implement multiple inheritance in the arguments-- Help is appreciated!localobject= {}
object.name=argl.nameor"Unknown"returnobjectend)
There we go, now we have our Human class that inherits from Being. Now if we create the Human class we need to provide an age and a name, and we will be able to get those properties as well.
We can also implement inheritance using the .include method in lobject. Let's declare our Human class without the direct inheritance:
localHuman=Class"Human" (function (argl)
-- I haven't been able to implement multiple inheritance in the arguments-- Help is appreciated!localobject= {}
name=argl.nameor"Unknown"returnobjectend)