You can create and initialize an object of a class on the heap with
heap-new ( ... class -- object ) and in the dictionary
... class -- object ). Both words invoke
consumes the stack items indicated by "..." above.
If you want to allocate memory for an object yourself, you can get its
alignment and size with
class-inst-size 2@ ( class --
align size ). Once you have memory for an object, you can initialize
init-object ( ... class object -- );
construct does only a part of the necessary work.
Go to the first, previous, next, last section, table of contents.