I'm trying to learn OOP in PHP, for now i have reached the abstract classes.
I have some problems understanding when should I implement abstract methods in the abstract class and when I should not.
For example, have this code:
<?php
abstract class concept_car {
/**
* Properties can not be declared as abstract natively:
* http://stackoverflow.com/questions/7634970/php-abstract-properties
*/
protected $weelNum = NULL;
protected $doorsNum = NULL;
protected $color = NULL;
protected $carType = NULL;
// the inheritance class must define this methods
abstract public function setWeelNum($weelNum);
abstract public function setDoorsNum($doorsNum);
abstract public function setCarType($carType);
}
I do not know if it is OK to declare the 3 methods as abstract or should I remove the abstract and implement them because the properties are in the same class as the methods.
In the actual form of the code I was thinking that I must declare the methods as abstract here and implement them in the inheritance class, in the child class, but I don't know if this is the correct way.
P.S: I am a beginner and I am trying to understand how things go, I didn't reach at design patterns yet so please explain me in concepts so i can know what is the right way to proceed.