Difference between revisions of "PHP:Define a Class"

From Progzoo
Jump to: navigation, search
Line 5: Line 5:
 
*attributes <code>n, w</code> and <code>h</code>  
 
*attributes <code>n, w</code> and <code>h</code>  
 
*a method: <code>bmi</code>
 
*a method: <code>bmi</code>
<prog>
+
<prog><![CDATA[
 
<?
 
<?
 
class Person {
 
class Person {
Line 27: Line 27:
 
  echo ($p->n);
 
  echo ($p->n);
 
?>
 
?>
</prog>
+
]]></prog>
 
</question>
 
</question>

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]