codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
<?php // sample code to show the use of magic methods __construct and __destruct // author@ : http://royads.blogspot.com class parentClass { function __construct() { echo "\nParent constructor called."; } function __destruct() { echo "\ndestroying parent object"; } } class childClass extends parentClass { function __construct() { echo "\nchild constructor called."; parent::__construct(); } function __destruct() { echo "\ndestroying child object"; parent::__destruct(); } } $obj = new childClass(); ?>
Private
[
?
]
Run code