=====================================================================
Assume that you want to code a door. Doing that means that you have to
create functionality that allows the opening and closing of a passage
between two rooms. Perhaps you want to be able to lock and unlock the
door, and perhaps you want the door to be transparent. All of this
must be taken care of in your code. Furthermore, you have to copy 
the same code and make small variations in description and use
every time you want to make a new door. 

After a while you'll get rather tired of this, particularly
because you'll find that other wizards have created doors of their
own that work almost - but not quite - the same way your does, 
 rendering some of your nifty objects and features useless anywhere
but in your domain. 

The object oriented way of thinking is that instead of doing things
over and over, you create a basic door object that can do all the
things you want any door to be able to do. Then you just inherit
this generic door into a specialized door object where you
configure exactly what it should be able to do from the list
of available options in the parent door. 

It is even possible to inherit several different objects in
order to combine the functionality of several object types into one. 
Be aware that if a object's parent objects define functions with 
the same names, they will clash. It may not be easy to fix this
problem, so avoid inheriting from more than one parent until
you're reasonably sure what you're doing. 

The syntax for inheriting objects is very simple. 

%^CYAN%^%^BOLD%^-----< syntax for inherit >-----

[private] inherit <file_name>; 

%^RED%^%^BOLD%^SPECIAL NOTE --- When building you would have noticed a capitolized
            entry for <file_name>, These file_names were most likely
             defined in the #include <std.h> file.


%^CYAN%^%^BOLD%^-----< Samples of inherit syntax >-----

	inherit "/std/door";
	inherit "/usr/common/object";
    
Note that this is not a preprocessor command, it is a statement, 
so it does not have a # in front of it. It also ends with a ;. 
You may specify that it's a .c file if you wish, but doing so 
isn't required. 

Inheritance statements must come before any variable or function
definitions, included in #include files. This is one reason
you can't use the standard include file (mentioned down below) 
to add a variable to every LPC program -- if you did, that 
variable would be declared before any inheritance, so no LPC 
program could inherit anything! 

The child object (the one that declares the inheritance, as above) 
will inherit all inheritable functions and variables. This means
that simply calling a function with the name declared in the
parent will call that function as the parent defines it. Or, if 
the child defines it, it will be called with the child's definition. 
That is the power of inheritance -- the same name can refer to any 
of a family of functions, tailored to different objects. 

If a child object has a function with the same name as a function 
in the parent, the child's function will mask the parent's. 
When the function is called by an external call to the child, 
the child function will be executed. To call the parent function 
from the child, call the function name with the scope operator, 
::, before it. 

void my_func() {
    ::my_func();        /* Call my_func() in the parent. */
}
    

It is not possible to call a masked function in the parent 
by an external call -- only from within the object itself. 
If an object inherits an object that has inherited another object, 
e.g. C inherits B that inherits A, then masked functions in A 
are available in B. If B masks that function then C will get 
B's version when it calls the function with the scope operator. 
If B doesn't mask the function then C would get A's version 
instead. 

If a parent is inherited with the private qualifier, only the
object inheriting it will be able to see its functions. External 
function calls won't find the private parent's functions, and 
child objects won't be able to call the functions inherited from 
that parent. To export the functions in a private parent object, 
have the child object declare functions with the same names that 
pass the arguments through to the parent. 

The net affect of using the private qualifier with inherit is
similar to if you had declared each and every function in the
parent using the static qualifier.
=============================================================================

Ironman
