I m试图书写为一年级学生创建的一种方法,该方法被分配到_orm(),接受单一论点,即学生。
这种方法应当做到两点:
Check to see if the number of items in the occupants property array is equal to or greater than the capacity property. If so, return FALSE. If not, take the student object, and add it as an item in the occupants property array.
<?php
class Dorm
{
private $dorm_name;
private $capacity;
private $occupants = array();
public function assign_to_dorm(Student)
{
$ammount = count($occupants);
if($ammount >= $capacity)
{
return FALSE;
}
} // <--------------- KEEP GETTING ERRORS HERE
}
?>