From ba53e5edacde726a20f2e091e6da64a6dbdd6ba9 Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Mon, 11 Jan 2021 16:38:56 +0900 Subject: [PATCH] Mention class fields in API docs --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 53a4ff6..38d2973 100644 --- a/README.md +++ b/README.md @@ -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: