PHP

Visibility (public, private, protected)

Në shqip: Dukshmëria në PHP

ShpjegimiSQ

Çdo fushë dhe metodë në PHP ka një nivel dukshmërie: public (kushdo), protected (klasa dhe fëmijët e saj), private (vetëm vetë klasa).

EnglishEN

Every property and method in PHP has a visibility level: public (anyone), protected (the class and its children), private (only the class itself).

Si ta mendosh

Si dhomat e shtëpisë: dhoma e ndenjes, kuzhina, dhoma jote.

Lexoje në anglisht

Like the rooms of a house: living room, kitchen, your bedroom.

Shembull kodiphp

<?php
class Llogari {
  private float $bilanci = 0;
  public function depozito(float $s): void { $this->bilanci += $s; }
}

Terma të lidhur