March 2010
Beginner
760 pages
18h 51m
English
Inheritance is one of the most fundamental ideas behind object-oriented programming. The basic idea is that a class inherits, or copies, all the fields from some class and then possibly expands the number of fields in the new data type. For example, suppose you created a data type point that describes a point in the planar (two-dimensional) space. The class for this point might look like the following:
type
point: class
var
x:int32;
y:int32;
method distance;
endclass;Suppose you want to create a point in 3D space rather than 2D space. You can easily build such a data type as follows:
type
point3D: class inherits( point )
var
z:int32;
endclass;The inherits option on the class declaration tells HLA to insert the fields of point at ...