This forum is now read-only. Please use our new forums at discuss.codecademy.com.

Objects in PHP Forum

View Course » View Exercise

625 points
52e12b95631fe908670004b2_159375742
Submitted by
chechu87
over 3 years ago

My code works.. but gives an error when I try to submit

This code prints "Meow meow" but when i tried to submit it says " your 'new' cat ought to be called "Codecat"..?

        <?php
      // Your code here
      class Cat{
          public $isAlive = true;
          public $numLegs = 4;
          public $name;

        public function __construct($name){
            $this->name = $name;
        }
        public function meow(){
            return "Meow meow";
        }
      }
      $cat1 = new Cat("Codecat");  //created a new instance of class
      echo $cat1->meow();


    ?>

1 vote

permalink

Try "CodeCat" -- with both "c"s uppercase.

572 points
52f1d2e39c4e9dbb8d000250_986039286
Submitted by
Byron Canfield
over 3 years ago


1 vote

permalink

It wants "CodeCat" typed with apostrophes. Change it to 'CodeCat' and then submit

73 points
F56bf9c23889f175ea67405e6438ba5f?s=140&d=retro
Submitted by
tesmith86
about 3 years ago