Object Oriented Programming (Course 1)
The Constructor!
  Start your All-Access Pass to unlock this challenge
Buy Access Login

Challenge 1 / 1

Check out the following class:

class Animal
{
    private $name;
    private $species;

    public function getSummary()
    {
        return "The animal's name is " . $this->name . " and its species is " . $this->species . ".";
    }
}

To guarantee that both $name and $species are always set (so that getSummary() doesn't return a nonsensical string), where could we enforce this requirement? Choose the best option:

Skip challenges and

Turn Challenges Off?

All further challenges will be skipped automatically.
You can re-enable challenges at any time on this page or from your account page.