ep8_oop_classes_and_objects.php
<?php
class Car {
public $color;
public $model;
public $brand;
function getCarMake(){
return "The car brand is $this->brand and the model is $this->model and the color is $this->color";
}
}
$carOne = new Car();
$carOne->color="white";
$carOne->model="Safari";
$carOne->brand="Tata";
echo $carOne->getCarMake();
$carTwo = new Car();
$carTwo->color="black";
$carTwo->model="Scorpio";
$carTwo->brand="Mahindra";
echo $carTwo->getCarMake();
Output
Output for this tutorial goes here.
1 - The car brand is Tata and the model is Safari and the color is white
2 - The car brand is Mahindra and the model is Scorpio and the color is black