Class Inheritance: Difference between revisions
m (Added category.) |
mNo edit summary |
||
Line 1: | Line 1: | ||
this is not ready for prime time. | this is not ready for prime time. | ||
=terms= | |||
*'''config''' is a config.cpp or config.bin. It is NOT a model.cfg | |||
*'''master''' config.bin is the in-game, one and only config built from all other configs | |||
*'''bin''' config.bin is the father of all other config.bins. It forms the first state of the master config.bin | |||
*'''child''' config.bins are added to the master config.bin | |||
=externs= | |||
externs are a simple concept to understand, and a difficult thing to implement correctly. | |||
simply stated, an extern is telling both the compiler and later, the game engine, that there is a class entry _at this indent_ in the master config.bin | |||
there may, or may not be an inheritence association with an extern class, but it cannot be declared in the above way and isnot necessary to do so | |||
1) IF you are not using any embedded classes of that extern | |||
2) you have properly declared via requiredaddons which config this extern is actually in | |||
1) | |||
class extern; | |||
class thing:extern | |||
{ | |||
class one {...} /is fine it's your class, not the externs | |||
} | |||
class extern; | |||
class thing:extern | |||
{ | |||
class one:one {...} //is not fine you are stating (in most cases) there is a class one ALSO in the extern that you wish to inherit from | |||
} | |||
==engine build== | |||
class extern; causes the engine to create an empty class at that indent _if at the time of encounter_, there is no class in the master bin | |||
later, when the 'real' class is discovered, it replaces that empty class | |||
if the 'real' class actually has an inheritance, you are in trouble. the engine will complain | |||
=other= | |||
i am just getting some ideas down on how to explain | i am just getting some ideas down on how to explain |
Revision as of 12:28, 19 June 2015
this is not ready for prime time.
terms
- config is a config.cpp or config.bin. It is NOT a model.cfg
- master config.bin is the in-game, one and only config built from all other configs
- bin config.bin is the father of all other config.bins. It forms the first state of the master config.bin
- child config.bins are added to the master config.bin
externs
externs are a simple concept to understand, and a difficult thing to implement correctly.
simply stated, an extern is telling both the compiler and later, the game engine, that there is a class entry _at this indent_ in the master config.bin
there may, or may not be an inheritence association with an extern class, but it cannot be declared in the above way and isnot necessary to do so
1) IF you are not using any embedded classes of that extern 2) you have properly declared via requiredaddons which config this extern is actually in
1)
class extern; class thing:extern { class one {...} /is fine it's your class, not the externs }
class extern; class thing:extern { class one:one {...} //is not fine you are stating (in most cases) there is a class one ALSO in the extern that you wish to inherit from }
engine build
class extern; causes the engine to create an empty class at that indent _if at the time of encounter_, there is no class in the master bin
later, when the 'real' class is discovered, it replaces that empty class
if the 'real' class actually has an inheritance, you are in trouble. the engine will complain
other
i am just getting some ideas down on how to explain
- the necessity of requiredAddons[]= aka the pbo loading order
- the difference between config tree declarations vs their bodies
- what class blah{}; actually does (vs blah:blah{}) and how to implement it properly
- how ofp behaves differently in class trees and what access= is all about
Class Inheritance refers to the way in which classes are superimposed onto each other.
class Base { a base class containing (probably) embedded classes class EmbeddedClass { ... }; class InheritedClass:EmbeddedClass { ... }; };
The above is the creation of the class with real values
example
class Vehicles { class Vehicle{......}; class Car:Vehicle{......}; class Truck:Car{......}; };
Inheritance skeleton
The engine needs to know how above is constructed when inheriting from it
if you aren't altering embedded classes:
class Car;
altering things in truck
class Car; class Truck:Car{....};
class anything{}; wipes out previous. NOTE however that requiredAddons is needed