tryphp_class3.php:
name = $name; } function get_name() { return $this->name; } function set_color($color) { $this->color = $color; } function get_color() { return $this->color; } } $apple = new Fruit(); $apple->set_name('Apple'); $apple->set_color('Red'); echo "Name: " . $apple->get_name(); echo "
"; echo "Color: " . $apple->get_color(); ?>
Name: Apple
Color: Red