Class Inheritance

From Bohemia Interactive Community
Revision as of 01:25, 23 July 2010 by Mikero (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Class Inheritence 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{......};

};

Inheritence skeleton

The engine needs to know how above is constructed when inheriting from it


if you aren't altering embededded classes:

class Car;

altering things in truck

class Car; class Truck:Car{....};

class anything{}; wipes out previous. NOTE however that reqiored addons is needed