|
CHAPTER 2
Basic Concepts:
The main duty of a basic and generic room support is to provide the code
for a lot of features, which the wizard doesn't have to program in each
room again. This concept is named code sharing.
LPC understands two ways of code sharing: Include and inherit. These ways
totally different and I'll explain the difference to you.
- Include is a preprocessor command. This means, the command is executed
before the program is compiled. The include command copies a whole file
to the line where is is stated. Therefore include is mostly used to get
defines (string replacements) and macros. These are also inserted into
the program text by the preprocessor. If program code is being included
it would have to be compiled again. There we come to the second way:
- Inherit is one of the concepts of Object Orientated Programming (OOP).
It doesn't copy code, but copies the function and variable tables of
an already compiled program into another. This means, if one program
inherits another program, the inherited functions and variables don't
have to be compiled again. But their references are copied so they are
present in the inherited-by program.
Changed/modified by Kiri in August 2016.
See also: |
|