Coder Profile - Show off your skills, get a coder profile.
 
 
 
code pin board abstract class init Download Source Code
Author Details Code Information
Visie ( Lucas )

Pinned 2 Codes
Posted 0 Coding Articles

Send A Message
View Coders Profile
Language PHP (Hypertext Preprocessor)
Expires Never
Length 1,062 Characters (52 Lines)
Password no password
  1. <?
  2.  
  3.     // a test-class
  4.     class my_class
  5.     {
  6.       private $my_var;
  7.       private $name;
  8.  
  9.       function my_class()
  10.       {
  11.         $this->my_var = "here I am";
  12.       }
  13.  
  14.       function set_name($name)
  15.       {
  16.         $this->name = $name;
  17.       }
  18.  
  19.       function say_hello()
  20.       {
  21.         return "hello, dude! my parent object is <strong>".$this->name."</strong>";
  22.       }
  23.     }
  24.  
  25.  
  26.  
  27.     // abstract init
  28.  
  29.     $class = 'my_class';
  30.     $obj_var_name = 'my_object';
  31.     ${$obj_var_name} = new $class();
  32.  
  33.  
  34.  
  35.     // test the object
  36.  
  37.     echo "$".$obj_var_name.":<pre>";
  38.     # print_r($my_object);
  39.     print_r(${$obj_var_name});
  40.     echo "</pre>";
  41.  
  42.     # print_r($my_object->set_name($obj_var_name));
  43.     print_r(${$obj_var_name}->set_name($obj_var_name));
  44.  
  45.     echo "$".$obj_var_name."->say_hello():<pre>";
  46.     # print_r($my_object->say_hello());
  47.     print_r(${$obj_var_name}->say_hello());
  48.     echo "</pre>";
  49.  
  50.     exit();
  51.  
  52. ?>
code pin board Back To Code Pin Board Post New Code
Please login to post comments.
Page 1 of 1
 
 
Latest News About Coder Profile
Coder Profile Poll
Why do you get bored with programming?

Not enough time to do something productive
I run out of ideas
Too hard to show people my creations
Everything i do has too many errors, and it's too hard
I don't get bored!!!


please login to cast your vote
and see the results of this poll
Latest Coder Profile Changes
Coder Profile was last updated
3.20 Years Ago
Official Blog :: Make A Donation :: Credits :: Contact Me
Terms & Conditions :: Privacy Policy :: Documents :: Wallpapers
Version 1.46.00
Copyright © 2007 - 2012, Scott Thompson, All Rights Reserved