How do I add a speak method to the Dog class below. I am trying to give the dog the ability to bark.
<?php
class Dog
{
private $dog_weight = 0;
private $dog_breed = "no breed";
private $dog_color = "no color";
private $dog_name = "no name";
function display_properties()
{
print "Dog weight is $this->dog_weight. Dog breed is $this->dog_breed. Dog color is $this->dog_color.";
}
}
?>
Not sure if you're being downvoted because of the basic nature of the question, but essentially you'll simply need to:
echo
(or print
as you have above) the content you want the Dog class to sayCheck out the "Defining Class Methods" section on this tutorial for an easy overview.