Here are some code:
<?php
class Vehicle
{
private $environment;
public function selectEnvironment($userinput){
$this->environment = $userinput;
}
}
$watercraft = new Vehicle;
$watercraft->selectEnvironment("Sea");
?>
I'm still trying to get a grasp of OOP concepts. Here the $environment field is set to private and can only be access by the public function selectVehicle. what happens now? What can I do with $watercraft->selectVehicle("Sea");?
Can you write some code to demonstrate what you can do with this?
I meant to say selectEnvironment, not selectVehicle.for the public function name.
Bookmarks