flash - question about function and class names having similar name -


wouldn't there naming collision cause in case, function name , class name both named documentclass can explain in layman's terms cause i'm still newbie in flash as3

package com.identitymine.documentclass {    import flash.display.movieclip;    public class documentclass extends movieclip    {       public function documentclass()    {    }  } } 

this constructor - called whenever create instance of class.

think of this.. when say:

var thing:myclass = new myclass(); 

you're:

  1. creating new instance of myclass.
  2. calling myclass() method.

other languages use different methods, example define constructor of class in php use __construct() so:

class myclass {     public function __construct()     {         echo 'hello, exist now';     } } 

so creating instance of class so, output 'hello, exist now' onto page.

<?php $thing = new myclass(); ?> 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -