|
parent::constructor |
| PHP5 allows you to use the namespaces like parent or base class and a child or extended class. The :: operator connect the variable or object that could |
| <html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>parent self name spaces</title> </head> <body text="#FFFF00" bgcolor="#000080"> <?php class dady { const name="Manas"; function _construct() { print (" I am a parent : ".self::name ."<br/>"); } } class son extends dady { const name="Baba"; function _construct() { parent::_construct(); print ("I am a child : ". self::name ." child constructor <br>"); print ("I am a child calling parent: ". parent::name ." child constructor <br>");} } $d = new son(); $d->_construct(); ?> <p> </p> </body> </html> |
![]() |