FluffOS - constructs / inherit


where pathname is a full path delimited by quotes (e.g. “/std/Object”).

The ‘inherit’ statement provides the inheritance capability (a concept from object-oriented programming) to LPC objects. Inheritance lets an object inherit functions and variables from other objects. Because the MudOSdriver internally stores global data and compiled code separately, many different objects can use inheritance to share the same piece of compiled code. Each of these objects will have its own local copy of any global variables defined by the object. Suppose that two object A and B inherit object C. Recompiling object either of A or B will not cause C to be recompiled. However, it will cause any global variables provided by C to lose whatever data they had (remember that A and B each have their own copy of the global variables provided by C. Thus updating A will not effect the global variables of B (even those provided by C) and vice versa).

This is a companion discussion topic for the original entry at https://www.fluffos.info/lpc/constructs/inherit.html#gsc.tab=0