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?

Entry

How would you access an objectís properties and methods from outside the objectís class?

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


You can call an objectís methods and access its properties using a 
reference to the object(usually stored in a variable)in conjunction 
with the ->operator;
//installing an object
$p =new Point(40,60);
//calling an objectís method
$p->moveTo(20,200);
//accessing an objectís property
print $p->x;
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