Time for action – Writing our Component class

As you may have guessed, we will begin with a very simple Component class — all it has to do at first is to have two Hashes: one for metadata, the other one for properties.

class Component
{
   public var properties : Hash<String>;
   public var metadata : Hash<String>;
   
   public function new()
   {
      properties = new Hash<String>();
      metadata = new Hash<String>();
   }
}

It is that simple at the moment.

As you can see, we do not implement access via the dot-notation at the moment. We will do it later, but the class won't be very complicated even with the support for this notation.

Get haXe 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.