Jump to content

Kasha

New Members
  • Posts

    2
  • Joined

  • Last visited

Kasha's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yaaaay it works!! Thaaanks....I found the problem...I wrote "Codecat" instead of "CodeCat" Problem solved.
  2. Hey people! I'm new here and I desperately need your help! I have my PHP exam on monday so I'm practicing with codeacademy. I know it's easy stuff for you, but don't judge and help a girl out please! These are the instructions: Create a class called Cat. Add two public properties to this class: $isAlive ought to store the value true and $numLegsshould contain the value 4. Add a public $name property, which gets its value via the__construct()or. Add a public method calledmeow(), which returns "Meow meow". Create an instance of the Catclass, which has the $name "CodeCat". Call the meow() method on thisCat and echo the result. This is my code: <?php class Cat { public $isAlive = true ; public $numLegs = 4 ; public function __construct ($name) { $this -> name = $name ; } public function meow () { return "Meow meow" ; } } $cat1 = new Cat ("Codecat", "Codecat" , "Codecat") ; echo $cat1->meow (); ?> This is the error: Oops, try again. Hey, your 'new' cat ought to be called 'CodeCat'!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.