topical media & game development

talk show tell print

professional-php-01-new-class.Demo.php / php



  <?php
  
    class Demo {
  
      private _name;
  
      public function sayHello() {
        print "Hello {this->getName()}!";
      }
  
      public function getName() {
        return this->_name;
      }
  
      public function setName(name) {
        if(!is_string(name) || strlen(name) == 0) {
          throw new Exception("Invalid name value");
        }
  
        this->_name = name;
      }
  
    }
  
  ?>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.