Newbie question about OOP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jeddiki
    Contributor
    • Jan 2009
    • 290

    Newbie question about OOP

    In my class_lib.php in have defined a class
    and set up a construct method like this:

    Code:
    <?php
    class person {
      var $name;
      var $pinn_number; 
          public $height;
          protected $social_insurance;
          
     
      function __construct($persons_name) {
        $this->name = $persons_name;
      }
    	
    	    
    } // end class
    ?>
    By setting up the construct, does this mean that I don't have to set up the
    set_ method in order to add properties ?

    i.e. this isn't needed

    Code:
    function set_name($new_name) {  
       $this->name = $new_name;            
      }
    I know this is basic, but I am just learning OOP :)
Working...