A
          / \      _                                               Nemesis on 
          | |     | |  _______   _        _   _______    _______   _    _______
          | |\    | | |   ____| |  \    /  | |   ____|  /   ____| | |  /   ____|
 /-------/-------------------------------------------------------------------,
O= Home <=XX|  About  News  Pics  Adventurers  Wizards  Download  Connect     >
 \-------\-------------------------------------------------------------------'
          | |   \   | |  |____  | |      | | |  |____   ___ \  \  | |  ___ \  \
          | |     \_| |_______| |_|      |_| |_______| |_______/  |_| |_______/
          \ /
           V  

Documentation Area

Document Path: /doc/room2/page24


<
                                 CHAPTER 2                                      
The Room2 Dualism:

   Each of the two code sharing concepts described in the last chapter has
   drawbacks.

   Inheritance is very efficient but it can be rather unflexible. It forces
   not much compiling but it is only possible to inherit all (free) functions
   and variables. If the room code is very large and has too many features,
   almost every room would have a lot of functions and variables that are not
   used at all.

   On the other hand, include is very flexible because preprocessor commands
   provide a lot of flexibility: it is very useful to separate features for
   many different rooms from each other. So only features that are needed
   are present in the code. But including is rather inefficient as included
   code has to be compiled every time when it is included.

   Room2 works with a combination of includes and inherits and tries to take
   advantage of the features of both concept. It has proved that inherit is
   more efficient for normal rooms and a combination of include and inherit
   is better for rooms with special features. The wizard can decide between
   these two modes before he begins programming a new room.

   Addendum:
   Kiri says in 2016: We will try to enhance this dualism but stay nearer
   to the the concept of inheritance. This is to make feature available via
   standard room2 without switching to EXTD_ROOM. See the last page (31) of
   this tutorial or https://nemesis.de/lpc/doc/room2/page31 .

   Changed/modified/modernised by Kiri in August 2016.

See also:
>

This page was generated in LPC

Imprint / Impressum