0

I am calling the isCatLover function without an arguments. Is the : bool related with the datatype of the return value.

class Person {   
   const CAT = 'cat';   
   const DOG = 'dog'; 

   private $petPreference; private $pet;

   public function isCatLover(): bool {  
     return $this->petPreference == self::CAT;  
   }  
   public function isDogLover(): bool {   
     return $this->petPreference == self::DOG;    
   }  
}

0 Answers0