* public class *, what is its function in the action script?

0

Good people, I'm trying to learn ActionScript 3.0 to understand how the source of a game works, because it has a part of the script that I can not find a good explanation on the internet that is public class , in following code:

package
{
    import mx.core.BitmapAsset;

    public class §_-6Ze§ extends BitmapAsset
    {


        public function §_-6Ze§()
        {
            super();
        }
    }
}

Would you explain? All help is welcome!

    
asked by anonymous 16.06.2018 / 19:31

1 answer

2

Imagine that I have the following code,

var meuBitmap:BitmapAsset = new §_-6Ze§();

I can only do this without having a syntax error because:

  • §_-6Ze§ is of type BitmapAsset
  • §_-6Ze§ is a public class
  • §_-6Ze§ has a public default constructor

If a class is public, anyone can inherit from this class, no matter what the point in the code.

If a constructor is public and the class to which it belongs is public, anyone can instantiate this class with this constructor.

If a method is public and the class to which it belongs is public, any instance of that class can call this public method.

In your example, in the default constructor of §_-6Ze§, there is a reserved word, which is super . It refers to the parent class of the current class. The () that follows demonstrates a call to the default constructor of the parent class.

    
16.06.2018 / 19:39