Skip to content

Namespaces

In C++, things can be organized in namespaces. Namespaces are typically applied to classes.

namespace Geo {

    class Point
    {
    public:
        double get_x();
        void set_x(double x);
        double get_y();
        void set_y(double y);
    private:
        double x;
        double y;
    };

}

To use the Point class, one would have to write Geo::Point in C++. In itemis CREATE, namespaces are reflected as packages. For each header file you import into your statechart, a package is created, plus an additional package for each namespace.

In the definition section, one would write:

import: "Point.h"
interface:
    var PointA: Geo.Point
    var PointB: Geo.Point
    out event e

Namespaces can be nested, so if namespace Geo would be contained in namespace Math, Point would be addressed as Math.Geo.Point.