So given all that, let's say we have the following objects:Each class object is based on whatever class it extends, or Object if not specified. The global class object Object is based on Class.Prototype, which is based on Object.Prototype, so classes can inherit methods and properties from any of these base objects.
Code: Select all
class animal {
}
class dog extends animal {
}
wally := animal.new()
fido := dog.new()
Code: Select all
any.prototype class
(type:prototype) (type:class)
/|\ |
| (base) (base) |
| (base) (base) \|/
object.prototype <----- class.prototype <----- object
(type:prototype) (type:prototype) (type:class)
/|\ /|\
| (base) (base) |
| (base) |
animal.prototype <----- wally animal
(type:prototype) (type:animal) (type:class)
/|\ /|\
| (base) (base) |
| (base) |
dog.prototype <----- fido dog
(type:prototype) (type:dog) (type:class)