Mention class fields in API docs

This commit is contained in:
K. Lange 2021-01-11 16:38:56 +09:00
parent eb27158173
commit ba53e5edac

View File

@ -1276,9 +1276,10 @@ Here we have created a new class named `MyNameClass` and exposed it through the
```c
myNewClass->base = vm.objectClass;
krk_tableAddAll(&vm.objectClass->methods, &myNewClass->methods);
krk_tableAddAll(&vm.objectClass->fields, &myNewClass->fields);
```
We also want to make sure that our new class fits into the general inheritence hierarchy, which typically means inheriting from `vm.objectClass` - we do this by setting our new class's `base` pointer to `vm.objectClass` and copying `vm.objectClass`'s method table. Now we can start customizing our class with its own methods.
We also want to make sure that our new class fits into the general inheritence hierarchy, which typically means inheriting from `vm.objectClass` - we do this by setting our new class's `base` pointer to `vm.objectClass` and copying `vm.objectClass`'s method and field tables. Now we can start customizing our class with its own methods.
Native functions are attached to class method tables in a similar manner to normal functions: