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:
- creating new instance of myclass.
- 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
Post a Comment