This forum is now read-only. Please use our new forums! Go to forums
Response ;Did you create a 'Cat' class? ---> but , it's my error .. but idont see...
<?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";}
}
$nam= new Cat("CodeCat");
echo $nam->meow();
// Response ;Oops, try again! Did you create a ‘Cat’ class? —> ?>
Answer 5252d6d080ff33a453000186
Answer 51c35b8b631fe9f7ee002df2
1 vote
Try adding
$cat1 = new Cat("CodeCat");
echo $cat1->meow();
Answer 51b8cde6282ae3a0fb0002c3
Answer 51d47c3f631fe981f900227b
Answer 52004f3980ff331be5000d9b
0 votes
try this…
class Cat{
public $isAlive = true;
public $numLegs = 4;
public $name;
public function __construct($name){
$this->name= $name;
}
public function Meow() {
return "Meow meow";}
}
$cat = new cat ("CodeCat");
echo $cat->Meow();
Answer 531dfd198c1ccccff0000c98
0 votes
Sorry, no offence, but you all are wrong. I just figured out the problem. <?php Class Cat{ public $isAlive=true; public $numLegs=4; public $name; public function __construct($name){ $this->name=$name ;
}
public function meow(){
return "Meow meow";}
}
$name= new Cat("CodeCat");
echo $name->meow();
?>
You put nam instead of name. Hope this was helpful and continue learning.
Answer 536cff6c548c3542840001b5
0 votes
class is spelled with a lowercase “c” and you also have name spelled wrong
Answer 519f95216653d64768000053
-6 votes
I am sorryyyyyyyyyyyyyyyyyy $cat1 i don tsee the name is $cat1 on exmaple ……….
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
1 comments
And the Class -.————- reverse to ————— class