Book Image

haXe 2 Beginner's Guide

5 (1)
Book Image

haXe 2 Beginner's Guide

5 (1)

Overview of this book

Table of Contents (21 chapters)
haxe 2
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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.