O'Reilly logo

haXe 2 by Benjamin Dasnois

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The remoting service

We will now add our remoting service. This remoting service will provide clients with the following two methods:

  1. getList: This method will return the list of animals.
  2. addAnimal: This method will take a name and a number to create an animal and add it to the list of animals in the zoo.

In order to provide this service, we will simply create a class named Service and implement the preceding two functions in it.

The getList function

The getList function will simply return the list from the Zoo class:

public static function getList() : List<Animal>
{
returnZoo.animals;
}

Ok, this one was pretty simple in our case.

The createAnimal function

The addAnimal method will create an instance of animal setting its name and number fields with ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required