Multiple choice technology web technology

Which of the following is correct code to define a contructor in ActionScript class?

  1. private constructor classname()

  2. public constructor classname()

  3. private function classname()

  4. public function classname()

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

ActionScript constructors are defined as public functions with the same name as the class. They don't use the 'constructor' keyword (that's a naming convention in some languages, not ActionScript syntax), and constructors cannot be private.