begeiste
11-21-2011, 10:56 PM
Hi,
I have created a class "friendClass" and tried to echo it. It prints nothing without any errors, not sure what was it going on? Any helps would be appreciated!
class friendClass{
//attributes - variable
public $name;
public $sex;
public $title;
public $country;
//methods - function
public function eat(){}
public function watch(){}
public function drive(){}
public function speak(){}
}
$friend1 = new friendClass;
$friend2 = new friendClass;
$friend3 = new friendClass;
$friend4 = new friendClass;
$friend1 -> name = "Bach";
$friend1 -> title = "Muscian";
$friend1 -> sex = "Male";
$friend1 -> country = "Germany";
$friend1 -> eat("Bread");
$friend1 -> speak("German");
$friend1 -> drive("Horse");
$friend1 -> watch("Beethoven");
echo "Name is: ".$friend1->name;
I have created a class "friendClass" and tried to echo it. It prints nothing without any errors, not sure what was it going on? Any helps would be appreciated!
class friendClass{
//attributes - variable
public $name;
public $sex;
public $title;
public $country;
//methods - function
public function eat(){}
public function watch(){}
public function drive(){}
public function speak(){}
}
$friend1 = new friendClass;
$friend2 = new friendClass;
$friend3 = new friendClass;
$friend4 = new friendClass;
$friend1 -> name = "Bach";
$friend1 -> title = "Muscian";
$friend1 -> sex = "Male";
$friend1 -> country = "Germany";
$friend1 -> eat("Bread");
$friend1 -> speak("German");
$friend1 -> drive("Horse");
$friend1 -> watch("Beethoven");
echo "Name is: ".$friend1->name;