Difference between revisions of "PHP:Define a Class"

From Progzoo
Jump to: navigation, search
Line 12: Line 12:
 
   public function __construct($name, $weight, $height)
 
   public function __construct($name, $weight, $height)
 
   {
 
   {
     this->name = $name;
+
     $this->name = $name;
     this->weight = $weight;
+
     $this->weight = $weight;
     this->height = $height;
+
     $this->height = $height;
 
   }
 
   }
 
   public function bmi()
 
   public function bmi()

Revision as of 15:25, 12 February 2009

The class Person has

  • a constructor: Person
  • attributes n, w and h
  • a method: bmi


[Font] [Default] [Show] [Resize] [History] [Profile]