View Single Post
  #36 (permalink)  
Old 04-28-2008, 07:09 AM
jegan jegan is offline
D-Web Sr.Programmer
 
Join Date: Jul 2007
Posts: 161
jegan is on a distinguished road
Default Re: PHP Classes For Beginners

Private Variables
Private variable and method accessible only within the class. Not possible from outside of class.

PHP Code:
<?php
    
class dog 
{
        Private 
$Name;
        }

    class 
poodle extends dog
 
{ }

    
$poppy = new poodle;
    
$poppy->Name "Poppy";
    print (
$poppy);

?>
The derived class object try to access the private member variable of class dog. but it not possible to access from out side of class.
__________________
Thanks & Regards,
Jegan CBK
"We will either find a way, or make one!”
Reply With Quote