faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

0 of 1 people (0%) answered Yes
Recently 0 of 1 people (0%) answered Yes

Entry

How would you create a constructor method in a class?

Mar 22nd, 2008 21:34
ha mo, Himanshu Jain,


You can create a constroctor by declaring a method that has the same
name as the class that contains it.The constructor will be called
automatically when an object is instantiated from the class.
Class point
       {
       //properties
       var $x – 0;
       var $y = 0;
      //constructor
      function Point($x , $y)
             {
             //set up code goes here
             }
     }
http://www.tantofa.com
http://www.fantofa.com
http://www.mantofa.com
http://www.tanpola.com
http://www.tampola.com
http://www.yamot.com
http://www.mozmar.com
http://www.templatestemp.com