টপিকঃ inheritence এ একটু প্রবলেম
<?php
class parents{
public $age;
public $name;
public $sex;
public function __construct($age,$name,$sex){
$this->age = $age;
$this->name = $name;
$this->sex = $sex;
}
parent::childs
public function parentsinfo(){
echo "Parents age is : ".$this->age."<br>";
echo "Parents name is : ".$this->name."<br>";
echo "Parents sex is : ".$this->sex."<br>";
}
}
class childs extends parents{
public function childinfo(){
echo "child age is : ".$this->age."<br>";
echo "child name is : ".$this->name."<br>";
echo "child sex is : ".$this->sex."<br>";
}
}
$stparents = new parents(23,"nazmul","male");
$stparents->parentsinfo();
$childs-> new parents(1,"usman","male");
$childs->childinfo();
?>
এখানে শেষের দিকের $childs-> new parents(1,"usman","male"); এই লাইনে এরর আসে কেন ? আমি তো আগের ক্লাসের সাব ক্লাসকে কল করেছি ।