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

The Animal class


In order to store information about animals, we will create a class named Animal. This class will be very simple, but it will have to be shared by both the client and the server. Indeed, the server will serialize several instances of this class, which means that the client will need this class to be able to unserialize it.

So, let's see how this class looks:

package zooKeeper;

class Animal
{
   public var name : String;
   public var number : Int;
   
   public function new()
   {
      name = "";
      number = 0;
   }
}