All Questions
3
questions
1
vote
2
answers
2k
views
Private property in parent class can be accessed and re-assigned through the instance of child class in PHP but protected one can't
I am very confused why $produk1->harga = 500; can still make a change
(or re-assign the value 500) to private $harga property despite private $harga in class Produk has PRIVATE visibility ? $...
2
votes
1
answer
268
views
php inheritance with protected array property is giving me a serious headache
So I decided to make some classes in PHP so I can dynamically construct a menu bar using <ul>, <li> and <a> tags. Reason why is because I want to reuse this across projects.
First the Blob ...
3
votes
2
answers
3k
views
Visibility of __construct
If I have:
abstract class AbstractSingleton
{
protected static $instance;
public static function & getInstance()
{
if(null === static::$instance) static::$instance = new ...