1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
<?php class hello { function __construct($hello,$world) { $this->set("hello", $hello); $this->set("world", $world); } function set($var, $val) { $this->{$var} = $val; } function get($var) { return $this->{$var}; } public function sayhello() { echo $this->get("hello")." ".$this->get("world"); } } $hello = new hello("Привет", "Sanasol"); $hello->sayhello(); ?> |